Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC Vs n-tier architecture

People also ask

What is the difference between n tier architecture and MVC?

Mvc enhance modularity within the Presntatio Layer by separating the logical part of this layer in the controllers, and the graphycal part in the Views. N-Tiers architecture are about a separation in Layer of the whole system not only of the Presentation Layer.

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.

Is MVC the same as 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 difference between Tier and n tier architecture?

The second tier is responsible for providing the availability, scalability, and performance characteristics for the organization's web environment. In an n -tier architecture, application objects are distributed across multiple logical tiers, typically three or four.


N-tier architecture usually has each layer separated by the network. I.E. the presentation layer is on some web servers, then that talks to backend app servers over the network for business logic, then that talks to a database server, again over the network, and maybe the app server also calls out to some remote services (say Authorize.net for payment processing).

MVC is a programming design pattern where different portions of code are responsible for representing the Model, View, and controller in some application. These two things are related because, for instance the Model layer may have an internal implementation that calls a database for storing and retrieving data. The controller may reside on the webserver, and remotely call appservers to retrieve data. MVC abstracts away the details of how the architecture of an app is implemented.

N-tier just refers to the physical structure of an implementation. These two are sometimes confused because an MVC design is often implemented using an N-tier architecture.


If a 3-tier design were like this:

Client <-> Middle <-> Data

the MVC patter would be:

     Middle
     ^    |
     |    v
Client <- Data

Meaning that:

  • in the 3-tier equivalent, communication between layers is bi-directional and always passes through the Middle tier
  • in the MVC equivalent the communication is in unidirectional; we could say that each "layer" is updated by the one at the left and, in turn, updates the one at the right –where "left" and "right" are merely illustrative

P.S. Client would be the View and Middle the Controller


This is what say about n-tier architecture

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.


The only similarity is that the two patterns have three boxes in their diagrams. Fundamentally they are completely different in their uses. If fact, it is not usually a choice between which pattern to use, but both patterns can be use together harmoneously. Here is a good comparison of the two: http://allthingscs.blogspot.com/2011/03/mvc-vs-3-tier-pattern.html