mvvm pattern

MVVM stands for Model-View-Viewmodel, a pattern used for example in applications & programs for windows.

ModelViewViewmodel

First, lets take a look at the three parts:

Model

a model is an object which stores data, and most of the time represents an object from the real world which is managed by the application. It is used to store data.

Viewmodel

Each page in your application has a Viewmodel associated with it. The Viewmodel provides all data to be displayed in the view and all commands which a user is able to execute

View

The View focuses solely on display.

Why use this pattern?

This pattern, similar to MVC, allows a loose coupling between Application Logic and View Logic. This has some numerous advantages:

  • extensibility & maintainability
  • if you have to redesign the application, you would not need to rewrite already working application logic, you only have to replace the view, and vice versa
  • easy for other developers to understand what you were doing

The full power of this pattern, and why I love it more than MVC, is shown the way it is supported in windows applications.

I’ve made an example in C#: github

I explain this example in detail here

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *