Today, I found a video of Stanford that was inspired by some of the ideas that iOS7 developed, and from the beginning to the end, it felt like MVC was developed for iOS (as if it had been HTML, didn't know), and it felt like MVC was still important.
1. What is MVC
The full name of MVC is the model View Controller, which is the abbreviation for the models-view-controller, a software design paradigm that organizes the code with a method of business logic, data, and interface display separation. Aggregating business logic into a single component does not require rewriting business logic while improving and personalizing the interface and user interaction. MVC is uniquely developed to map the traditional input, processing, and output functions in a logical graphical user interface structure.
view = What
you see on the screen (called by the Controller) The benefit of MVC is that it can handle many differentView. There is really no real processing happening in the view, whether the data is stored online or an employee list, as a view, it is simply a way to output data and allow the user to manipulate it. model =
What your program is (not how your program is displayed) models represent enterprise data and business rules. Of the three parts of MVC, the model has the most processing tasks. For example it may be used likeEJBcomponents such as S and ColdFusionObjectto handleDatabase, the data returned by the model is neutral, which means that the model is independent of the data format, so that a model can provide data for multiple views, and because the code applied to the model can be reused by multiple views only once, reducing the duplication of the code. Controller=
How to render your model to the user (program logic) The controller accepts the user's input and invokes the model and view to complete the user's needs, so when you clickWebhyperlinks and send in pagesHTML Formwhen the controller itself does not output anything and do any processing. It simply receives the request and decides which model component is called to process the request, and then determines which view to use to display the returned data。
Take Stanford's PPT to explain the MVC implementation
650) this.width=650; "Src=" http://m1.img.srcdd.com/farm2/d/2011/1102/18/DB98A8D101A92066FBD6D264B7486D90_B500_ 900_500_280.jpeg "width=" "height=" 280 "alt=" db98a8d101a92066fbd6d264b7486d90_b500_90 "/>
First the controller communicates with the Model,controller and the view, and the model and view cannot communicate
There are two modes of communication between the Controller and the view: the data source method and the proxy method, which will be written in the next blog. Those classes that inherit Uicontrol, such as buttons, communicate via action or outlet (the output port).
DataSource method (data source)
V No matter the data is saved, but the data update needs C to display.
Proxy method (delegate)
Action or outlet
Those classes that inherit Uicontrol, such as buttons, communicate via action or outlet (output port)
Update of data between controller and model via notification (notification) or KVO
Dark Horse Programmer-3. MVC Framework