Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
iAmNaN68458yIn a nutshell, the GUI (frontend) is developed separately from the business logic (backend). Among other things, it allows your business logic to be more portable. I think that's it. In a nutshell.
-
mvvm is three tiers in the GUI.
The model (m) is your data or configuration, view (v) is what draws on screen, view-model (vm) is code that binds them.
But like I said, that is just the GUI. Which is part of a larger system of Business Logic, Data Access, cross cutting code of security, logging, and exceptions, which may or may not be on the same system. And you may have different GUIs from Web, Native App, OS, Mobile so some parts of your mvvm may be shared across devices. -
abcdev30758yMVVM : Model-View-View Model
Model : this represents a set of classes that describes the logic and data. It also defines rules for data, means how the data can be changed and manipulated.
View: this represents the UI components like CSS, jQuery, html and so on. It is only responsible for displaying the data that is recieved from the controller as the result. Basically it transforms the model or models into UI.
View Model : this is responsible for exposing methods, commands and other properties that helps to maintain the state of the view, manipulate the model as result of actions on the view, and trigger events on the view itself.
To understand it clearly you will need to understand MVC and MVP as well. -
So you basically bind your View to the ViewModel using two way data bindings, meaning that changing a value within the view changes it in the ViewModel and vice versa. That has the benefit of separating the logic behind your view (the ViewModel) from the view itself. This allows you to easily write tests for the logic without the need to actually use any ui at all.
-
donuts236728yAlso the VM can also implements INotifyPropertyChanged so the View will update when one of properties is changed.... but you have to implent the Properties with custom setters that file the event....
I ended up creating utility classes to abstract all this boilerplate away... though I think PRISM framework has this stuff but sorta felt that thing is overkill for non-enterprise apps? -
@billgates For non enterprise apps you just shove it all into main() and let it fall to the end? Asking for a friend.
-
donuts236728y@bkwilliams no.... unless u want to do SPA.... hm maybe then PRISM would help... I don't like SPAs though... not Desktop. Check my github, there's a lot of MVVM apps I made including devrant.
Related Rants
Can any one explain to me the mvvm pattern ?
undefined
programming
mvvm