search
HomeCommon ProblemWhat is the difference between mvvm mode and mvc mode

The difference between mvvm mode and mvc mode is: 1. Controller in MVC evolves into ViewModel in MVVM; 2. MVVM displays the view layer through data instead of node operations; 3. MVVM mainly solves a large number of problems in MVC DOM operations reduce page rendering performance.

What is the difference between mvvm mode and mvc mode

The difference between mvvm mode and mvc mode is:

1. What is MVVM?

Under the MVVM framework, the view and the model cannot communicate directly. They can only interact through the ViewModel. It can monitor data changes and then notify the view to automatically update. When the user operates the view, the VM It can also monitor changes in the view and then notify the data to make corresponding changes. This actually realizes two-way binding of data. And V and VM can communicate.

Picture examples are as follows:

What is the difference between mvvm mode and mvc mode

Advantages of MVVM pattern:

Low coupling :View can change and modify independently of the Model. A ViewModel can be bound to different Views. When the View changes, the Model can remain unchanged, and when the Model changes, the View can also remain unchanged.

Reusability: You can put some view logic in a ViewModel, allowing many Views to reuse this view logic.

Independent development: Developers can focus on the development of business logic and data, and designers can focus on page design.

2. What is MVC?

MVC is one of the most widely used software architectures. Generally, MVC is divided into: Model (model) ,View(View),Controller(Controller). This is mainly based on the purpose of layering to separate each other's responsibilities. View generally uses Controller to communicate with Model. Controller is the coordinator of Model and View, and View and Model are not directly connected. Basically it's a one-way contact. M and V refer to the same meaning as M and V in MVVM. C means Controller refers to the page business logic. MVC is one-way communication. That is, View and Model must be connected through Controller.

3. The difference between mvc and mvvm:

The difference between MVC and MVVM is not that VM completely replaces C. The purpose of ViewModel’s existence is to abstract Apart from the business logic displayed in the Controller, rather than replacing the Controller, other view operation services should still be implemented in the Controller. In other words, MVVM implements the reuse of business logic components.

- Controller in MVC evolves into ViewModel in MVVM

-MVVM displays the view layer through data instead of node operations

-MVVM mainly solves a large number of dom in MVC The operation reduces the page rendering performance, slows down the loading speed, and affects the user experience

The above is the detailed content of What is the difference between mvvm mode and mvc mode. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function