MVC principle and the advantages and disadvantages of MVC pattern __ Design Pattern

Source: Internet
Author: User
MVC principle and the advantages and disadvantages of MVC pattern MVC design Pattern Data structure Framework Web First, MVC principle
MVC is a program development design pattern, which realizes the separation between the display module and the functional module. It improves the maintainability, portability, scalability and reusability of programs, and reduces the difficulty of program development. It is mainly divided into three layers of model, view and controller.
1. Model It is the main part of the application, including the Business logic module (the Action,dao class in the Web project) and the Data module (Pojo Class). The model is independent of the data format, such 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 repeatability of the Code
2, view users interact with the interface, in the Web view is generally composed of jsp,html
3, the Controller (Controller) to receive requests from the interface and to the model for processing in this process the controller does not do any processing just played a connection to do with

Second, the advantages of MVC
1. Multiple views can be established and used at run time for a model. The change-propagation mechanism ensures that all relevant views are in time for model data changes so that all associated views and controllers are synchronized.
2, the view and the controller of the pluggable, allows the replacement of view and controller objects, and can be dynamically opened or closed according to requirements, or even during the run for object replacement.
3, the model portability. Because the model is independent of the view, a model can be ported independently to the new platform. All you need to do is make new changes to the view and controller on the new platform.
4, the potential frame structure. You can build an application framework based on this model, not just in design interface design.

Iii. the shortcomings of MVC
1, increased the system structure and implementation of the complexity. For a simple interface, strictly following MVC, separating the model, view, and controller will increase the complexity of the structure and may result in excessive update operations and lower operational efficiency.
2. The connection between the view and the controller is too tight. The view and controller are separate, but closely connected parts, the view has no controller, its application is very limited, and vice versa, which hinders their independent reuse.
3, the view of the model data inefficient access. Depending on the model's operating interface, the view may require multiple calls to obtain sufficient display data. Unnecessary frequent access to unchanged data also impairs operational performance.
4, at present, the general advanced interface tools or constructors do not support the mode. The cost of adapting these tools to the MVC requirements and building separate parts is high, resulting in the difficulty of using MVC.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.