Skip to content
Joe Care edited this page Jan 18, 2025 · 10 revisions

MVVM - Pattern

the MVVM - Pattern is a technique to handle GUI-Application, in opposide to the MVC/MVP-Pattern it implements a clear need-to-know structure. The Application is divided into three main components.

See Wikipedia: MVVM-Pattern

flowchart LR;
   subgraph View
    A[View]==>B[Converter];
    A==>C[Validator];
    click A href "MVVM_View"
    click B href "MVVM_Converter"
    click C href "MVVM_Validator"
   end
subgraph ViewModel
    D[ViewModel];
    click D href "MVVM_ViewModel"
end
subgraph Model
    E[Model];
    click E href "MVVM_Model"
end    
A -- read/write properties --> D
A -- read/execute commands --> D
B -- read/write properties --> D
D -- read/write data --> E
A -- read/write properties --> E
Loading

The Model

Here the real work of the application is done. data-handling, storing, aquiring, shifting, calculation ...

See Bussiness-logic
See also the MVVM - Tutorial in this repository

the classes of this part concentrate purely on the task to prepare the data for the GUI in a way that is agnostic of the GUI itself. Classes of the ViewModel should only know if things in this and the Model-part.

The View (Views)

Here "View" as a name of the part is givenen the name if it's parts -> the views.

This is the part that defines the GUI. it should mostly relay on data provided by the ViewModel, and also send events (commands) to the ViewModel. Any visual component (e.G: a window, a page, a user-control ...) is considerd a View and is implemented in a viewing-class. As a rule of thumb - every View-class has its dedicated ViewModel-class

Clone this wiki locally