What is MVVM?
- MVVM stands for Model-View-ViewModel
- Model: plain old class object
- View: markup (usually pasred by view engine)
- ViewModel: domain model in cotext of MVVM (a class that containes implementation of business logic)
- MVVM is an architectural design pattern used in application development / software engineering.
- Main advantage of MVVM (or any other architectural design pattern general) is “seperation of concerns”
- MVVM facilitates the separation of the development of the GUI from the development of the business logic
Comparison to MVC
- Similarity: You can think of VM in MVVM is equivalent to C in MVC
- Differences:
- MVC format is specifically designed to create a separation of concerns between the model and view
- MVVM format with data-binding is designed specifically to allow the view and model to communicate directly with each other
- ViewModel isn’t a controller, instead acts as a binder that binds data between the view and model
Usage
- Desktop
- Mobile
- Xamarin.Forms (Prism)
- Uno
- Web
- ASP.NET Core razor pages
- Blazor