Model–View–Viewmodel (MVVM) Architectural Pattern

From GM-RKB
(Redirected from MVVM)
Jump to navigation Jump to search

A Model–View–Viewmodel (MVVM) Architectural Pattern is a front-end architectural pattern composed of a app model layer (that handles app business logic, a app view layer (that handles app view logic) and a modelview layer (that handles app information binding).



References

2022

2022

  • https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel#Components_of_MVVM_pattern
    • Model
      Model refers either to a domain model, which represents real state content (an object-oriented approach), or to the data access layer, which represents content (a data-centric approach).[citation needed]
      View
      As in the model–view–controller (MVC) and model–view–presenter (MVP) patterns, the view is the structure, layout, and appearance of what a user sees on the screen.[4] It displays a representation of the model and receives the user's interaction with the view (mouse clicks, keyboard input, screen tap gestures, etc.), and it forwards the handling of these to the view model via the data binding (properties, event callbacks, etc.) that is defined to link the view and view model.
      View model
      The view model is an abstraction of the view exposing public properties and commands. Instead of the controller of the MVC pattern, or the presenter of the MVP pattern, MVVM has a binder, which automates communication between the view and its bound properties in the view model. The view model has been described as a state of the data in the model.[5]
      The main difference between the view model and the Presenter in the MVP pattern is that the presenter has a reference to a view, whereas the view model does not. Instead, a view directly binds to properties on the view model to send and receive updates. To function efficiently, this requires a binding technology or generating boilerplate code to do the binding.[4]
      Binder
      Declarative data and command-binding are implicit in the MVVM pattern. In the Microsoft solution stack, the binder is a markup language called XAML.[6] The binder frees the developer from being obliged to write boiler-plate logic to synchronize the view model and view. When implemented outside of the Microsoft stack, the presence of a declarative data binding technology is what makes this pattern possible,[7][8] and without a binder, one would typically use MVP or MVC instead and have to write more boilerplate (or generate it with some other tool).
  1. 1.0 1.1 Cite error: Invalid <ref> tag; no text was provided for refs named MVVM-eliminates-valueconverters
  2. 2.0 2.1 2.2 Cite error: Invalid <ref> tag; no text was provided for refs named JoshSmith
  3. Cite error: Invalid <ref> tag; no text was provided for refs named Gossman2005
  4. 4.0 4.1 "The MVVM Pattern". https://msdn.microsoft.com/en-us/library/hh848246.aspx. Retrieved 2016-08-29. 
  5. Pete Weissbrod. "Model–View–ViewModel Pattern for WPF: Yet another approach.". http://www.acceptedeclectic.com/2008/01/model-view-viewmodel-pattern-for-wpf.html. 
  6. Wildermuth, Shawn. "Windows Presentation Foundation Data Binding: Part 1". Microsoft. http://msdn.microsoft.com/en-us/library/aa480224.aspx. Retrieved 24 March 2012. 
  7. Cite error: Invalid <ref> tag; no text was provided for refs named SMassey
  8. "ZK MVVM". Potix. http://books.zkoss.org/wiki/Small_Talks/2012/February/New_Features_of_ZK_6#ZK_MVVM. Retrieved 24 March 2012. 

20xx