Advantages of MVC Most web applications developed in procedural languages such as ASP and PHP have the initial development template for data programming in the hybrid layer. For example, sending a request directly to the database and displaying it in HTML tends to be fast, but because the separation of data pages is not very direct, it is difficult to reflect the appearance of the business model or the reusability of the model. The flexibility of product design is very small, and it is difficult to meet the changing needs of users. MVC requires layering of applications, although it takes extra work, but the structure of the product is clear, and the application of the product can be better reflected through the model. First and foremost, there should be multiple views corresponding to the ability of a model. With the rapid changes in user needs, there may be multiple ways to access your application. For example, the order model may have orders from this system, online orders, or orders from other systems, but the processing of orders is the same, which means that the processing of orders is the same. According to the MVC design pattern, one order model and multiple views can solve the problem. This reduces code copying, i.e., reduces the amount of code maintenance, and is easy to maintain once the model changes. Second, since the data returned by the models does not have any display format, these models can also be directly applied to the use of interfaces. Third, since an application is separated into three layers, sometimes changing one of the layers satisfies the change of application. A change in an application's business process or business rules only requires a change in the MVC model layer. The concept of the control layer is also valid, because it combines different models and different views to complete different requests, so the control layer can be said to contain the concept of user request permissions. Finally, it also facilitates software engineering management. Because different layers perform their own duties, each layer of different applications has some of the same characteristics, which is conducive to the generation of hypervisor code through engineering and tooling. The shortcomings of MVC The shortcomings of MVC are reflected in the following aspects: (1) increases the complexity of system structure and implementation. For simple interfaces, strictly following MVC to separate models, views, and controllers will increase the complexity of the structure and may produce too many update operations, reducing operational efficiency. (2) view and controller too tight connection. Views and controllers are separate but closely related parts, and the use of views without controllers is limited, and vice versa, which prevents their independent reuse. (3) view inefficient access to model data. Depending on the model operation interface, the view may need to be called multiple times to obtain sufficient display data. Unnecessarily frequent access to unchanged data can also hurt operational performance. (4Currently, the MVC architecture is not supported by advanced interface tools or constructors. The cost of adapting these tools to fit MVC needs and establishing separated parts is high, making it difficult to use MVC.
|