Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference of developing a website in MVC and 3-Tier or N-tier architecture?

Tags:

What is difference of developing a website in MVC and 3-Tier or N-tier architecture?

Which one is better? What are pros and cons?

like image 942
Starx Avatar asked May 16 '10 10:05

Starx


People also ask

What is the difference between MVC and 3-tier architecture?

MVC is a pattern used to make UI code easier to maintain and test. When the MVC pattern is used a larger portion of the UI code can be unit tested. 3 tier architecture is a pattern used for a completely different reason. It separates the entire application into meaningful "groups": UI, Business Logic, Data Storage.

What is the difference between 3-tier and N-tier architecture?

In 3 Tier Application there are three tiers like Presentation Layer , Application Layer and Data layer. Here the application layer contains business logic as well . On the other hand in N Tier Application layer is divided into 2 i.e. Application Layer and Business Logic layer.

What is N-tier architecture in MVC?

Definition of N-Tier Architecture. N-tier architecture is also called multi-tier architecture because the software is engineered to have the processing, data management, and presentation functions physically and logically separated.

Is MVC multi-tier architecture?

No, they are not the same. MVC is a design pattern for structuring user interface code. It could be used in a three-tier architecture, in which case the pattern would belongs in the user services layer.


1 Answers

They're pretty much the same, however in 3-Tier, the top level (presentation) never directly communicates with the bottom layer (data persistence).

In model-view-controller, theoretically the Model is supposed to 'notify' the View that it has changed so that the View can update. However, this is usually not an issue in most web applications because they are stateless. I'm not sure if any well-known PHP MVC architectures have Views that directly communicate with Models or vice versa, but if they don't it would be correct to say that they are in fact 3-Tier.

Wikipedia says:

At first glance, the three tiers may seem similar to the MVC (Model View Controller) 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.

Source: Wikipedia: Multitier architecture

like image 53
Lotus Notes Avatar answered Sep 20 '22 16:09

Lotus Notes