Answer the question
In order to leave comments, you need to log in
What is the difference between MVVM and MVP?
Hey guys :-) I may have a trite question but very important for me :-)
What is the difference between "MVVM" and "MVP" ?
As I understand it (MVVM):
- Model [data]
- View [processes the visual part]
- ViewModel [processes the logic for the view using model (may have an additional class for processing data binding)]
As I understand it (MVP):
- Model [data binding]
- View [handles the visual part]
- Presenter [handles the logic for the view using the model]
Answer the question
In order to leave comments, you need to log in
How I structured it for myself.
MVC: View and Controller have access to data (Model). That is, the View can redraw itself only on the basis of data changes in the Model or user interaction with the View (clicking on the screen), or it can change the data in the Model itself; and only tell the controller about it. The Controller can change the state of the View based on its data sources (eg external requests, button clicks) and can also change the Model.
MVP: Presenter is an intermediary between View and Model. View and model are exchanged with data through the established API. The display in the View depends only on the data that the Presenter has set.
MVVM: ViewModel is also an intermediary between View and Model. But the ViewModel cannot directly affect the View, but is only a data source and has the ability to transfer actual data through call functions. What to display is determined at the View level.
The key difference is that in MVVM ViewModel contains state (state), while Presenter in MVP does not.
https://phaser.io/ - powerful framework with excellent state manager, good documentation; many examples.
Not an expert in python, but I think the same as with simple sites with a backend.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question