In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about the usefulness of the mvc framework. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Mvc framework is a model of software design, which organizes code with a method of separating business logic, data and interface display, and aggregates business logic into one component. When improving and customizing the interface and user interaction, there is no need to rewrite business logic.
1. What is mvc
Model View Controller, the abbreviation of model-view-controller, is a model of software design, which organizes the code with a method of separating business logic, data and interface display, and aggregates business logic into a component. When improving and customizing the interface and user interaction, there is no need to rewrite business logic. Mvc is used to map traditional input, processing, and output functions in a logical graphical user interface structure.
Mvc is similar to a three-tier architecture, which mainly adopts the idea of encapsulation (layering) to reduce the degree of coupling, so as to make our system more flexible and scalable.
Model is the part of an application that processes data logic. Usually model objects are responsible for accessing data in the database.
View is the part of an application that deals with the display of data. Typically, views are created based on the data model.
Controller is the part of an application that handles data interaction. Typically, the controller is responsible for reading data from the view, controlling user input, and sending it to the model.
2. Advantages of mvc
(1) multiple views share a model, which greatly improves the reusability of the code.
(2) the three modules are independent of each other, and changing one of them will not affect the other two, so a good loosely coupled component can be constructed according to this design pattern.
(3) the controller improves the flexibility and controllability of the application. The controller can be used to connect different models and views to meet the needs of users, so that the controller can improve the powerful means for constructing applications.
3. Shortcomings of mvc
The main contents are as follows: (1) it increases the complexity of system structure and implementation.
For simple pages, strictly following mvc, separating the model, view and controller will increase the complexity of the structure, and may produce too many update operations, which will reduce the running efficiency.
(2) the view is too closely connected to the controller.
Views and controllers are components that are separated from each other, but are really closely related to each other. Views do not have controllers, and their applications are limited, and vice versa, which hinders their independent reuse.
(3) the view's inefficient access to the model data.
Depending on the model operation interface, the view may need to be called multiple times to get enough display data. Unnecessary frequent access to unchanged data will also damage operational performance.
(4) at present, some advanced interface tools or constructors do not support mvc.
The cost of adapting these tools to the needs of MVC and establishing separate components is high, making it difficult to use MVC.
To sum up, for developing large applications with a large number of user interfaces and complex business logic, MVC will take your software to a new level in terms of robustness, code reuse, and structure. Although it will take some effort to build the MVC framework initially, it will greatly improve the efficiency of later software development in the long run. Therefore, when we apply it, we should comprehensively consider its scope of application.
4. Framework vs design pattern
(1) Framework is usually code reuse, while design pattern is design reuse.
The architecture is somewhere in between, part of the code reuse, part of the design reuse, and sometimes analysis can also be reused.
There are three levels of reuse in software production:
Internal reuse, that is, abstract blocks that can be used publicly in the same application
Code reuse, that is, combining common modules into libraries or toolsets that can be used in multiple applications and domains
The reuse of application framework, that is, to provide general or off-the-shelf infrastructure for dedicated areas to achieve the highest level of reusability.
(2) Design pattern is a description of the problem that occurs repeatedly in a certain environment and the solution to the problem, which is more abstract than the framework.
Frameworks can be represented in code, or they can be directly executed or reused, while for patterns, only instances can be represented in code.
A design pattern is a smaller element than a framework. A framework often contains one or more design patterns, the framework is always aimed at a specific application area, but the same pattern can be applied to a variety of applications.
It can be said that the framework is software, and design patterns are software knowledge.
(3) in short: the framework is the great wisdom, which is used to divide the software design; the design pattern is a small skill to propose solutions to specific problems in order to improve the code reuse rate and reduce the coupling.
Thank you for reading! This is the end of this article on "what is the use of the mvc framework?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.