当前位置:网站首页>The difference between MVC and MVP and MVVM
The difference between MVC and MVP and MVVM
2022-07-27 16:43:00 【Young people in Baima town】

MVC,MVP,MVVM The difference between design architecture , I believe you all know these concepts .
First , Be clear , The purpose of architecture is to improve development efficiency , Reduce maintenance costs .
Using object-oriented design principles , Divide the responsibilities of each module reasonably , In order to let others better understand the architectural design idea , Then give each module a general term explanation , To better clarify data binding , Here is a brief explanation of several common architectures ( With Android For example ).
MVC:- The model layer (
Model), Responsible for processing data logic , Generally, it includes database 、 Local data 、 Internet accessBeanOther components . - View layer (
View), Responsible for handling view display , Generally byXMLThe layout assumes this responsibility , Basic components and customizationViewAs a supplementary element of the view layer . - Control layer (
Control), Responsible for handling business logic , Generally byActivity、FragmentAssume this responsibility .
- The model layer (
MVP:- The model layer (
Model), Responsible for processing data logic , Generally, it includes database 、 Local data 、 Internet accessBeanOther components . - View layer (
View), Responsible for handling view display , Generally byXMLThe layout assumes this responsibility , Basic components and customizationViewAs a supplementary element of the view layer ,Activity、FragmentAct as an adhesive between the view layer and the control layer . - Logic layer (
Presenter), Responsible for handling business logic , From the original MVC Extracted from the control layerPresenterAct as the control layer (Presenter).
- The model layer (
MVVM:- The model layer (
Model), Responsible for processing data logic , Generally, it includes database 、 Local data 、 Internet accessBean、( Here I extract the view data separatelyViewDataThe concept also belongs to Model layer ) Other components . - View layer (
View), Responsible for handling view display , Generally byXMLThe layout assumes this responsibility , Basic components and customizationViewAs a supplementary element of the view layer ,Activity、FragmentIt is mainly responsible for the triggering of view layer binding events , Skilled words can also be directly inXMLBinding trigger event in . - Logic layer (
ViewModel), Connect through data bindingViewandModel( Here fromViewDataActing as a view model is bound to the view ) Realize the decoupling of view layer and model layer , Pass after the event is triggeredViewModelProcess business logic , And modify the view data in a data-driven way , And achieve the function of indirectly modifying the view . Be careful :ViewModelYou must not hold a reference to the view layer , Also cannot hold Context References to ! Or else MVP!
- The model layer (
MVC,MVP,MVVM The difference between design architecture , I believe you all know these concepts .
First , Be clear , The purpose of architecture is to improve development efficiency , Reduce maintenance costs .
Using object-oriented design principles , Divide the responsibilities of each module reasonably , In order to let others better understand the architectural design idea , Then give each module a general term explanation , To better clarify data binding , Here is a brief explanation of several common architectures ( With Android For example ).
MVC:- The model layer (
Model), Responsible for processing data logic , Generally, it includes database 、 Local data 、 Internet accessBeanOther components . - View layer (
View), Responsible for handling view display , Generally byXMLThe layout assumes this responsibility , Basic components and customizationViewAs a supplementary element of the view layer . - Control layer (
Control), Responsible for handling business logic , Generally byActivity、FragmentAssume this responsibility .
- The model layer (
MVP:- The model layer (
Model), Responsible for processing data logic , Generally, it includes database 、 Local data 、 Internet accessBeanOther components . - View layer (
View), Responsible for handling view display , Generally byXMLThe layout assumes this responsibility , Basic components and customizationViewAs a supplementary element of the view layer ,Activity、FragmentAct as an adhesive between the view layer and the control layer . - ??(
Presenter), Responsible for handling business logic , From the original MVC Extracted from the control layerPresenterAct as the control layer (Presenter).
- The model layer (
MVVM:- The model layer (
Model), Responsible for processing data logic , Generally, it includes database 、 Local data 、 Internet accessBean、( Here I extract the view data separatelyViewDataThe concept also belongs to Model layer ) Other components . - View layer (
View), Responsible for handling view display , Generally byXMLThe layout assumes this responsibility , Basic components and customizationViewAs a supplementary element of the view layer ,Activity、FragmentIt is mainly responsible for the triggering of view layer binding events , Skilled words can also be directly inXMLBinding trigger event in . - ??(
ViewModel), Connect through data bindingViewandModel( Here fromViewDataActing as a view model is bound to the view ) Realize the decoupling of view layer and model layer , Pass after the event is triggeredViewModelProcess business logic , And modify the view data in a data-driven way , And achieve the function of indirectly modifying the view . Be careful :ViewModelYou must not hold a reference to the view layer , Also cannot hold Context References to ! Or else MVP!
- The model layer (
边栏推荐
- ADAMS中转动整个模型
- After the cubemx is reconfigured, the generated code cannot be opened successfully with IAR
- Apache
- [paper reading] transformer with transfer CNN for remote sensing imageobject detection
- The method of inserting degree in word
- Great Cells & Counting Grids
- CCF-201312-1
- const小结
- my_ls小结
- Unable to enter the function definition after transferring the IAR project folder to the directory
猜你喜欢

The difference and use between get request and post request

Draw circuit diagram according to Verilog code

Log management

(二)动态卷积之Dynamic Convolution

The 21st - -- the 30th time

HowNet and Wanfang database download papers for free ----- several times faster than connecting to the school intranet (some schools Wanfang database does not support downloading)

The 31st --- the 52nd

CCF-201312-1

Scala for loop (loop guard, loop step size, loop nesting, introducing variables, loop return value, loop interrupt breaks)

CDQ divide and conquer and whole dichotomy learning notes
随机推荐
C language output string in reverse order
my_ Ls summary
Flowable process custom attribute
google chrome revercecaptcha广告屏蔽
KMEANS 实现
Scala for loop (loop guard, loop step size, loop nesting, introducing variables, loop return value, loop interrupt breaks)
(2) Dynamic convolution of dynamic convolution
*List reversal
Const summary
【pytorch】|transforms.FiveCrop
Unable to enter the function definition after transferring the IAR project folder to the directory
The solution to the memory exhaustion problem when PHP circulates a large amount of data
Quadratic programming based on osqp
Opencv (II) -- basic image processing
Replication of complex linked list
什么是jsp?
[cqoi2012] local minima & Mike and foam
training on multiple GPUs pytorch
Rotate the whole model in ADAMS
C语言逆序输出字符串