asp.net 4.5 exercise ~ what is MVC

I think it’s more useful to share a paragraph with you.

 

What is MVC

MVC English is Model-View-Controller, which separates the input, processing, and output processes of a Web application in the way of Model, View, and Controller, so that an application is divided into three layers-model layer, view layer, and control layer .

 

View represents the user interaction interface. For Web applications, it can be summarized as an HTML interface, but it may be XHTML, XML, and Applet. With the complexity and scale of the application, the handling of the interface becomes challenging. An application may have many different views. The processing of the views in the MVC design pattern is limited to the collection and processing of the data on the views, as well as user requests, and does not include the processing of business processes on the views. The processing of the business process is handed over to the model for processing. For example, a query view only accepts data from the model and displays it to the user, and passes the input data and requests of the user interface to the control and model.

 

Model is the processing of business processes/states and the formulation of business rules. The processing of the business process is a black box operation for other layers. The model accepts the data requested by the view and returns the final processing result. The design of the business model can be said to be the most important core of MVC. The current popular EJB model is a typical application example. It further divides the model from the perspective of application technology implementation in order to make full use of existing components, but it cannot be used as a framework for application design models. It only tells that certain technical components can be utilized by designing according to this model, thereby reducing technical difficulties. For a developer, he can focus on the design of the business model. The MVC design pattern shows that the applied model is extracted according to certain rules, and the level of extraction is very important, which is also the basis for judging whether the developer is excellent. The abstract and the concrete cannot be too far apart, nor too close. MVC does not provide a model design method, but is only responsible for organizing and managing these models, so as to facilitate model reconstruction and improve reusability. You can use object programming as a metaphor. MVC defines a top-level class to notify its subclasses to be able to do this, but there is no way to restrict the subclass to only do this. This is very important for programming developers. Another important aspect of the business model is the data model. The data model mainly refers to the data preservation (continuity) of physical objects. For example, save an order to the database, and get the order from the database. This model can be listed separately, and all database operations are restricted to this model only.

 

Control (Controller) can be understood as receiving requests from users, matching the model with the view, and completing the user's request together. The role of dividing the control layer is also obvious. It is a distributor, which model to choose, which view to choose, and what kind of user requests can be fulfilled. The control layer does not do any data processing. For example, after the user clicks a link, after the control layer accepts the request, it does not process the business information. It only passes the user's information to the model, tells the model what to do, and selects the view that meets the requirements and returns it to the user. Therefore, a model may correspond to multiple views, and a view may correspond to multiple models. The separation of model, view and controller allows a model to have multiple display views. If the user changes the data of the model through the controller of a view, all other views that depend on this data should reflect these changes. Therefore, whenever any data change occurs, the controller will notify all views of the change, resulting in an update of the display. This is actually a change of model-propagation mechanism.

 

 

 

 

Guess you like

Origin blog.csdn.net/modern358/article/details/114968477