The purpose of many systems is to retrieve data from a database and display it to the user. After the user has changed the data, the system stores the updates in the DB.
Since the flow of information is essential between the Db and the user interface, you might be inclined to bind these two ‘pieces’ together to reduce the amount of code and improve
application performance. However, this seemingly natural approach has some significant problems.
We face the speech
A first problem is that the user interface tends to change much more frequently than the data storage system.
Another problem with the coupling of data and user interface pieces is that business applications tend to incorporate business logic that goes well over the transmission of data.
To address and solve these and other problems have been introduced several architectural patterns such as MVC (Model – View – Controller).
MVC and MVP as MVVP represent patterns or templates to separate the User Interface and the corporate domain. Yet we can say that MVC defines a way of organizing user interface elements and services to businesses, without adding unwanted dependencies and improve the overall manageability of the products.
More specifically MVC is a pattern-oriented presentation; nTier and Layered architectures (which is what most people seem to indicate when they use the term “n-tier”) is
relate the physical and logical application.
Layered architecture does not need to be installed on a separate layer (tiers). Similarly, the MVC can be used for the presentation layer of an architecture Layered (and possibly multi-level ‘tiered’) or it can be used for monolithic application.
The first basic rule, if you want to remain closely linked to the philosophy of the model is that proper implementazionde MVC must be avoided dependencies (M) to Model (V) and view (C) Controller. This is the real ‘core’ of the pattern. Ultimately, if M has no dependency on V or C, the application is not ‘following the MVC pattern.
M does not have NO dependence C or V
C has no dependency on M and V
V dependence has only M
The idea is:
V raises event without knowing what Controller shall manage.
M changes without knowing what Controller or Vista if neither will.
As can be noted, C has dependencies with M and V. Thus, the elements of C can rely directly on elements of M and V (without any indirection or other model).
So the MVC (Model-View-Controller) divides an application into three components.
The MODEL contains the core functionality and data.
The VIEW displays information to the user.
The Controller handles user input.
View and Controller together form the user interface. A change in the propagation mechanism ensures consistency between the user interface and the model.
MVC and software layers
Martin Fowler defines the pattern “Layered Application” as a way to organize software into a set of logical layers for the purpose of managing dependencies and the creation
plug components. He mentions at least three layers: Presentation, Business and Data Access Domaian.
The MVC pattern defines an approach to the interaction between the components of the Business and Presentation Domain. So, it’s just a way to create a “connection” to connect two of all
these layers of software (MVC is not equivalent to the Three Layers). In addition, MVC is not provided with other relations between applizazioni such as persistence, security or scalability.
MVC and n-tier
Fowler and Trowbridge consider “n-tier” as a distribution model: a way to organize the infrastructure for running applications developed.
According to them, a web application can be distributed in three levels: client, web applications and data. In essence, it says that some components of the application can be deployed
on a set of client machines, other components of a whole host of web applications and other components in a set of server host data.
For solutions more stringent safety and operational requirements, you may want to consider some moving components to other additional levels.
Considering these three levels, MVC defines an approach to connect the components of presentation at the client (for example a mobile phone or internet applications)
with some components of the service-level web applications. MVC does not define anything about this interaction between the web, application layer and data layer
(MVC is not equivalent to the three levels).
The MVC pattern can be applied in applications that use only one level. For example, desktop development environments such as Eclipse and Netbeans apply the MVC pattern and
run on a single level.
There is a web page with a summary of the patterns from the book by Martin Fowler, “Patterns of Enterprise Application Architecture (P of EAA)”
http://martinfowler.com/eaaCatalog/ e http://martinfowler.com/eaaDev/uiArchs.html
Trowbridge has published, in turn, an updated catalog in the book Microsoft: “Enterprise Solution Patterns Using Microsoft. NET”
Is possible to download the book in PDF format from Microsoft
This is the link to Microsoft ‘Patterns & Practices’