Model View Presenter

Model View Presenter

Model View Presenter is a software pattern considered as a derivative of the Model-view-controller.

Pattern description

The View is defined as an interface that the Presenter will use for getting and setting data to and from the Model. The View implementation will instantiate the Presenter object and provide a reference to itself (the formal constructor parameter is the View interface while the actual parameter is a concrete View class).When the event methods of the View are triggered, they will do nothing but invoke a method of the Presenter which has no parameters and no return value. The Presenter will then get data from the View, through the View interface variable that the Presenter stored when the constructor was called. The Presenter then invokes methods of the Model, and sets data from the Model into the View through the View interface.

From a layering point of view, the Presenter class might be considered as belonging to the application layer in a multilayered architectured object-oriented system with common layers but it can also be seen as a Presenter layer of its own between the Application layer and the User Interface layer.

Pattern history

The Model View Presenter ("MVP") software pattern originated in the early 1990's at Taligent, a joint venture of Apple, IBM, and HP, and was the underlying programming model for application development in Taligent's C++-based CommonPoint environment. The pattern was later migrated by Taligent to Java and popularized in a paper by Taligent CTO Mike Potel [ [http://www.wildcrest.com/Potel/Portfolio/mvp.pdf "MVP: Model-View-Presenter. The Taligent Programming Model for C++ and Java." Mike Potel] ] . After the demise of Taligent in 1997, the MVP pattern was adapted by Andy Bower and Blair McGlashan of Dolphin Smalltalk to form the basis for their Smalltalk user interface framework [ [http://www.object-arts.com/papers/TwistingTheTriad.PDF "Twisting the Triad. The evolution of the Dolphin Smalltalk MVP application framework." Andy Bower, Blair McGlashan] ] . In 2006, Microsoft began incorporating MVP into their documentation and examples for user interface programming in the .NET framework [ [http://msdn.microsoft.com/en-us/library/cc304742.aspx "Microsoft patterns and practices"] ] . The evolution and multiple variants of the MVP pattern, including the relationship of MVP to other design patterns such as MVC, were analyzed in detail in articles by Martin Fowler [ [http://http://www.martinfowler.com/eaaDev/uiArchs.html "GUI Architectures" Martin Fowler] ] and Derek Greer [ [http://ctrl-shift-b.blogspot.com/2007/08/interactive-application-architecture.html "Interactive Application Architecture Patterns" Derek Greer] ] .

It is often claimed that this pattern has "Retired" (11 Jul 06) since Martin Fowler said so [ [http://www.martinfowler.com/eaaDev/ModelViewPresenter.html Retirement note for Model View Presenter Pattern ] ] . He split the pattern into Supervising Controller [ [http://www.martinfowler.com/eaaDev/SupervisingPresenter.html Supervising Controller ] ] and Passive View [ [http://www.martinfowler.com/eaaDev/PassiveScreen.html Passive View ] ] .Nevertheless, the pattern name still lives on the internet, and a Google search for the pattern still generates 34000+ hits, including a link to an article that has been published in MSDN Magazine [ [http://msdn.microsoft.com/en-us/magazine/cc188690.aspx MSDN Magazine article about MVP (August 2006) ] ] .

Pattern implementation in .NET

In a .NET environment the same Presenter class can be used for ASP.NET application and a Windows Forms application. The presenter gets and sets information from/to the View through an interface that in .NET can be implemented by both Windows Forms class and an ASPX page (the code-behind class can implement the View interface).

Instead of manually implementing the pattern, one of the Model-View-Presenter frameworks may be used. Below are listed some of such frameworks under the .NET platform.

Model-View-Presenter frameworks under .NET

* [http://www.MVCSharp.org MVC# Framework]
* [http://www.codeplex.com/nmvp NMVP Framework]

Pattern implementation in Java

In a Java (AWT/Swing/SWT) application, the MVP pattern can be used by letting the UI class implement a view interface.

The same approach can be used for Java thin (web based) applications since modern Java Component Based Web Frameworks allow development of client side logic using the same component approach as thick clients.To implement MVP in Google Web Toolkit one just needs to let any Component implement the view interface.The same approach is possible using the Echo2 web framework since the web framework uses Swing classes in its core.

----

Model-View-Presenter Frameworks Under Java

AWT

Swing

SWT

----

Model-View-Presenter Web Frameworks Under Java

Google Web Toolkit

Echo2

ee also

*Model-view-controller
*Common layers in an information system logical architecture

References

External links

* [http://c2.com/cgi/wiki?ModelViewPresenter Model-View-Presenter at WardsWiki]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Model–view–presenter — (MVP) is a derivative of the model–view–controller (MVC) software pattern, also used mostly for building user interfaces. In MVP the presenter assumes the functionality of the middle man (played by the controller in MVC). Additionally, the view… …   Wikipedia

  • Model View Presenter — (Abkürzung: MVP; wörtlich etwa ‚Modell Ansicht Präsentator‘) ist ein Entwurfsmuster in der Softwareentwicklung, das aus dem Model View Controller (Abkürzung: MVC) hervorgegangen ist. Es beschreibt einen neuartigen Ansatz, um das Modell (engl.… …   Deutsch Wikipedia

  • Model-View-Presenter — Шаблон проектирования Model View Presenter Model View Presenter (MVP)  шаблон проектирования, производный от MVC, который используется в основном для построения пользовательского интерфейса. В MVP Presenter берет на себя функциональность… …   Википедия

  • Model-view-presenter — Le Modèle Vue Presentation (en abrégé MVP, de l anglais Model View Presenter) est un Patron de conception, considéré comme un dérivé du Patron de conception Modèle Vue Contrôleur. Catégorie : Patron de conception …   Wikipédia en Français

  • Model-view-controller — (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the …   Wikipedia

  • Model View Controller — Konzept. Hinweis: die durchgezogene Linie symbolisiert eine direkte Assoziation, die gestrichelte eine indirekte Assoziation (zum Beispiel über einen Beobachter). Model View Controller (englisch  model view controller (MVC), deutsch auch: M …   Deutsch Wikipedia

  • Model–view–controller — A general representation of the MVC design pattern. Model view controller concept. The solid line represents a direct as …   Wikipedia

  • Model View ViewModel — The Model View ViewModel (MVVM) is an architectural pattern used in software engineering that originated from Microsoft as a specialization of the Presentation Model design pattern introduced by Martin Fowler.[1] Largely based on the Model view… …   Wikipedia

  • Model-View-Controller — Шаблон проектирования Model View Controller Кон …   Википедия

  • Model-View-ViewModel — Шаблон проектирования Model View ViewModel Шаблон Model View ViewModel  применяется при проектировании архитектуры приложения. Первоначально был представлен сообществу Джоном Госсманом (John Gossman) в 2005 году как модификация шаблона… …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”