In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What is the difference between mvvm mode and mvc mode? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Difference: Controller in MVC evolved into viewModel in MVVM. MVVM mainly solves the problems such as the degradation of page rendering performance and slow loading speed caused by a large number of DOM operations in MVC. When and Model change frequently in MVVM, developers need to actively update to View.
What is MVVM?
Under the MVVM framework, the view and the model can not communicate directly, but can only interact through ViewModel, it can monitor the changes of the data, and then notify the view to update automatically, and when the user operates the view, VM can also monitor the changes of the view, and then notify the data to make corresponding changes, which actually realizes the two-way binding of data. And V and VM can communicate.
An example of the picture is as follows:
Advantages of MVVM mode:
Low coupling: View can be changed and modified independently of Model, a ViewModel can be bound to different View, Model can not change when View changes, and View can not change when Model changes.
Reusability: you can put some view logic in a ViewModel and let many View reuse this view logic.
Independent development: developers can focus on business logic and data development, designers can focus on page design.
What is MVC?
MVC is one of the most widely used software architectures. Generally speaking, MVC is divided into:
Model (model), View (view), Controller (controller). This is mainly based on the purpose of layering to separate the responsibilities of each other.
View generally uses Controller to communicate with Model.
Controller is the coordinator of Model and View, and View and Model are not in direct contact. It's basically an one-way connection.
M and V mean the same as M and V in MVVM. C, or Controller, refers to the business logic of the page. MVC is an one-way communication. That is, View and Model, must use Controller to connect the preceding and the next.
Third, the difference between mvc and mvvm:
The difference between MVC and MVVM is not that VM completely replaces C _ Controller ViewModel exists to extract the business logic shown in Controller, not to replace Controller, other view operations should be implemented in Controller. In other words, MVVM implements the reuse of business logic components.
-Controller in MVC evolved into ViewModel in MVVM
-MVVM displays view layers through data rather than node operations
-MVVM mainly solves the problem that a large number of dom operations in MVC degrade the performance of page rendering, slow down the loading speed, and affect the user experience.
The answer to the question about the difference between mvvm mode and mvc mode is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.