N-Tier Architecture

3-Tier software architecture is client-server model where the presentation, the application processing, and the data management are logically separate processes. On web technologies, for example we have the Client (Presentation), Web server (Logical), and Database (Data Management) as the 3-tier. 2 -tier typically involves an architecture without data management where only the presentation and the logic is used.

Presentation tier:This is the topmost level of the application. The presentation tier displays information to and fro the Application Logic. It communicates with other tiers by outputting results to the browser/client tier and all other tiers in the network.

Application tier: (business logic, logic tier, data access tier, or middle tier). The logic tier is pulled out from the presentation tier and, as its own layer, it controls an application’s functionality by performing detailed processing.

Data tier: : This tier consists of database servers. Here information is stored and retrieved. This tier keeps data neutral and independent from application servers or business logic. Giving data its own tier also improves scalability and performance.

Model View Controller (MVC)

Model-View-Controller (MVC) is a software design pattern or software architecture that separates application logic from from input and presentation (UI), permitting independent development, testing and maintenance of each.

How are these architecture different

The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.
The View is the information that is being presented to a user. A View will normally be a web page, but in major frameworks, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of “page”.
The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.

The Difference Between these Two(2) Architectures

At first glance, the three tiers may seem similar to the model-view-controller (MVC) concept; however, topologically they are different. A fundamental rule in a three tier architecture is the client tier never communicates directly with the data tier; in a three-tier model all communication must pass through the middleware tier. Conceptually the three-tier architecture is linear. However, the MVC architecture is triangular: the view sends updates to the controller, the controller updates the model, and the view gets updated directly from the model.

How i got here?

As a PHP Programmer and a researcher, i have read about N-tier architectures and have always used the concepts when working on any of my projects. I got tired of writing some set of codes and started searching for easier and cleaner ways and that got me to PHP frameworks like cakephp, Yii, Codeigniter , Prado, symphony, and a host of others who use the MVC model for their design. An application designed around MVC is easier to manage because it is split into tiers, which allow for independent development. This promotes code reusability by building models, which are reusable throughout the application.

For PHP, many articles and ratings exist for which framework is easier, faster, or better. check typical rankings, ratings on php zone, e.t.c. I have not tried all but after trying Yii (1), CakePHP (2) and CodeIgniter (3), I’ll rate with 3-1-2 for ease of documentation and use.

MVC looks like the way to go, however its funny because looking at my “non-MVC” codes, they kinda work using the MVC principle. Then i’m thinking, i should rollout my own framework, i’ll call it, hmm…….. (xtend). Watch out in 2011.

See ya!!!