First, we introduce the concept of MVC:
MVC (Model View Controller) models, views, and controllers are a widely used structural design pattern.
Model: is the data that needs to be displayed in the MVC design pattern. Under normal circumstances, the model needs to read data from the database, save the state of the model, and provide access to data and data maintenance.
View: Is the user interface used to display the data in the model, generally carcass, and the view is an HTML page.
Controller: is used to process the user's input or interactive commands, in order to change the state of the model, select the appropriate view to display the corresponding model data.
The working mechanism is shown in the diagram on the right:
(1) The user makes a request to the controller.
(2) After the controller receives the user request, obtains the related data to the model request.
(3) The model returns the corresponding data to the controller.
(4) The controller sends the relevant data to the specified view.
(5) The view renders the data to the user.
Through the above introduction to believe that you have a certain understanding and understanding of MVC, then MVC and the original three-tier architecture we have learned exactly what are the similarities, and what are the differences?
What MVC has in common with layer three:
MVC is the same as the trigger point of the three-tier architecture-layering, decoupling. They all do the separation of the display and the data, which greatly reduces the coupling of the system.
But from a professional point of view, there is no relationship between MVC and layer three, layer three is three, MVC is MVC. The only thing that ties them together is the word "three", but learning is easier to understand from a beginner's perspective.
MVC differs from layer three:
It can be said that the rest of them are all different except the same. They have their own working mechanism for details, see:
The UI in layer three is broken down into MVC as view and Controller,bll and DAL are merged into model. Also in the three layer is called the three-tier architecture, but we can be divided into multiple layers according to needs. Model is also involved in layer three, but the model in the three layer is completely different from the model in MVC, and the model in the three layer is a table entity, while the model in MVC includes business logic and data access.
The features of MVC for Web form:
(1) Easy Unit Testing
(2) Easy to implement test-driven development
(3) Easy to expand and replace
(4) Support for features in web Form
(5) The URL is mapped to the controller
Although MVC has some new features for Web form, MVC does not replace the traditional Web Form technology, which is only applied in different scenarios and has different advantages and disadvantages. Cannot one-sided say that kind of technology high that technology low, the developer needs according to own actual situation chooses the corresponding technical development project. The above is an individual through the information on the MVC in the three-tier architecture of some understanding, there are shortcomings, please criticize correct.
The above is a brief talk on the MVC and three-tier architecture content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!