|
Model–view–viewmodel (MVVM) is a software architectural pattern. MVVM is a variation of Martin Fowler's (Presentation Model design pattern ).〔(The Presentation Model Design Pattern )〕 Like Fowler's Presentation Model, MVVM abstracts a view's state and behavior.〔 However, whereas the Presentation Model abstracts a view (i.e., creates a ''view model'') in a manner that does not depend on a specific user-interface platform, MVVM was developed by Microsoft architects Ken Cooper and Ted Peters specifically to simplify event-driven programming of user interfaces—by exploiting features of Windows Presentation Foundation (WPF) (Microsoft's .NET graphics system) and Silverlight (WPF's Internet application derivative).〔 John Gossman, one of Microsoft's WPF and Silverlight architects, announced MVVM on his blog in 2005. MVVM and Presentation Model both derive from the model–view–controller pattern (MVC). MVVM facilitates a separation of the development of the graphical user interface (either as markup language or GUI code) from the development of the business logic or back-end logic (the ''data model''). The ''view model'' of MVVM is a value converter;〔(【引用サイトリンク】title=Thought: MVVM eliminates 99% of the need for ValueConverters )〕 this means that the view model is responsible for exposing (converting) the data objects from the model in such a way that the objects are easily managed and consumed. In this respect, the view model is more model than view, and handles most if not all of the view's display logic.〔 The view model may also implement a mediator pattern, organising access to the back-end logic around the set of use cases supported by the view. Model–view–viewmodel is also called model–view–binder, especially in implementations that don't involve the .NET platform. ZK (a web application framework written in Java) and KnockoutJS (a JavaScript library) use model–view–binder.〔〔(【引用サイトリンク】KnockoutJS )〕 ==Components of the MVVM pattern== ;Model :''Model'' refers either to a domain model, which represents the real state content (an object-oriented approach), or to the data access layer that represents that content (a data-centric approach). ;View :As in the MVC and MVP patterns, the ''view'' is the user interface (UI). ;View model :The ''view model'' is an abstraction of the view that exposes public properties and commands. Instead of the controller of the MVC pattern, or the presenter of the MVP pattern, MVVM has a ''binder''. In the view model, this binder mediates communication between the view and the data binder. The view model has been described as a state of the data in the model. ;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. The binder frees the developer from being obliged to write boiler-plate logic to synchronise the view model and view. When implemented outside of the Microsoft stack the presence of a declarative databinding technology is a key enabler of the pattern.〔〔(【引用サイトリンク】url=http://books.zkoss.org/wiki/Small_Talks/2012/February/New_Features_of_ZK_6#ZK_MVVM )〕 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Model–view–viewmodel」の詳細全文を読む スポンサード リンク
|