Can someone please explain in a way as simple as possible what the Model View Presenter pattern is? What is the difference with Model View Controller ? Which is best or for which purpose ?
4 Answers
Model View Presenter and Model View Controller both try to solve the same "seperation of concerns" problem.
The primary difference you'll find is that Model View Controller (MVC) is often implemented with some coupling between the view and some model of some sort - thereby a given view is specifically purposed to provide a visualization of a given object (model).
In the Model View Presenter pattern you generally find that the Presenter takes care of working with the model, and deciding what information from it will be needed to form some sort of visualization.
In this diagram, arrows represent dependencies:
Typically you hear this pattern discussion come up when discussing the ASP.NET MVC framework, and come across information regarding the MVP pattern and it's implementation in ASP.NET WebForms. It is common in my experience that it is believed that WebForms is in and of itself an MVP patterned framework - this is not true. WebForms does however make it very easy to implement an MVP pattern - your best resource for this would be to investigate the Web Client Software Factory from the Patterns and Practices team.
-
I'm not sure those dependency arrows are right. In MVC, why does the View have a dependency on the Model? – Cameron MacFarland Aug 23 '09 at 04:23
-
2It certainly doesn't *have* to be, however this is the more common implementation. For example, if you use ASP.NET MVC the best practice is to make your "view" dependent on a type (creating a strongly typed view). Typical MVC implementations send a model to a view, then let the view decide what to do with it (thereby creating a dependency), whereas in MVP the View will literally ask the presenter "What data should I put in this textbox." – apiguy Aug 23 '09 at 04:32
Martin Fowler has a page on UI design patterns, in which he defines and then talks about MVC, MVP and other patterns.
http://martinfowler.com/eaaDev/uiArchs.html
To summarise the differences, Controllers in the MVC have more control over the UI, and handle events, while a presenter in the MVP is more passive, and just presents information through the UI.
In general there's not much difference, and often the line between them is blurry.

- 70,676
- 20
- 104
- 133
-
10In either case, you're involved with models, and that's got to be a good thing. – Noon Silk Aug 23 '09 at 04:10
Fowler separates MVP into 2 patterns: Supervising Presenter and Passive View.
Aviad Ezra has a good article on this topic http://aviadezra.blogspot.com/2008/10/model-view-presenter-design-pattern.html.
I think MVP is better for desktop, and MVC is for web app, because in desktop, Model has the capability to raise the event

- 913
- 10
- 15
-
I found the referenced article by Aviad Ezra to be quite helpful for getting me started using the MVP architectural pattern with my WinForms desktop application. The included example code is easy to understand. – DavidRR Jun 25 '14 at 14:08
-
You can raise events using ajax calls or websockets. It is about server-side actually. – hakan Feb 25 '16 at 07:39
Dolphin Smalltalk used to have an MVC implementation but then they migrated to MVP.
Here's the technical paper that outlines what they did and why.
IBM's Taligent system also used MVP - they describe what and why here.

- 351
- 3
- 17

- 6,941
- 3
- 39
- 48
-
-
1
-
@daf I was really interested to read but TwistingTheTriad.PDF goes to a blank page currently =( – Paul C Apr 25 '13 at 15:22