MVC Overview:
MVC (Modal View controler) m refers to the data model, v refers to the user interface, and C is the controller. The purpose of using MVC is to separate the implementation code for M and v so that the same program can use a different representation. For example, a batch of statistical data can be represented by a histogram, pie chart, respectively. C exists to ensure the synchronization of M and V, and once M is changed, V should be updated synchronously.
- A view is an interface that the user sees and interacts with. For older Web applications, views are an interface of HTML elements, and in modern Web applications, HTML still plays an important role in the view, but new technologies are emerging, including Macromedia Flash and Image xhtml,xml/xsl , WML, and some other identity languages and Web services.
- How to handle an application's interface becomes increasingly challenging. One big benefit of MVC is that it can handle many different views of your application. 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.
- Models represent enterprise data and business rules. Of the three parts of MVC, the model has the most processing tasks. For example, it may use artifact objects such as EJBS and ColdFusion to process the database. The data returned by the model is neutral, meaning that the model is independent of the data format, so that a model can provide data for multiple views. Because the code applied to the model can be reused by multiple views only once, it reduces the repetition of the code.
- The controller accepts the user's input and invokes the model and view to complete the user's needs. So when you click a hyperlink in a Web page and send an HTML form, 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 uses which view to display the data returned by the model processing.
General basic requirements for using the MVC pattern:
- The same information can be displayed in different Windows
- Data changes are immediately reflected in the display window
- user interface is easy to change and can even be changed at run time
- Different user interface styles do not affect the core logic of the application
Fishigui MVC pattern for the application layer:
According to the MVC pattern, the application layer (i.e. Fishiguidemo) of the Fishigui system can be further decomposed into the display layer and the application logic layer, the display layer contains the two internal components of the view and the controller, and the application logic layer is abstracted as the model component in the MVC pattern, in order to guarantee the software quality, Applications based on the development of Fishigui systems also need to follow certain design principles: the application Logic layer cannot invoke the elements of the display layer directly, so in order to update the user view. The registration must be changed in a way that is registered by the view in the model, and the updated information is sent by the model according to the registration information
MVC model and MVC model of Fishigui application layer