This project is read-only.

What Is MVP?

TODO - write about...
  • relationship to MVC
  • MVP in context of a standard DNN Module

Model View Presenter (MVP) is a pattern for separating the look of a web form from the logic that goes into generating that look. MVP is a close cousin of MVC (Model View Controller), and it has the following benefits for DotNetNuke module developers.
  • Testable Web Forms - With MVP, it is easier to write unit tests to ensure that the logic behind a web form is correct. Testability is usually a key reason that developers go to MVC or MVP.
  • Skill/Code Reuse - For those who have lots of experience (and code) tied up in MVC development, the Model View Presenter pattern makes it easier to gain key benefits of MVC (such as testability) in a Web Forms environment.

There are other benefits to MVP, of course, but these two are probably the most relevant for DotNetNuke module developers.

It is important to remember that MVP is primarily concerned with the UI (user interface) portion. The key idea here is to take the UI and separate the logic from the visual layout and the data. As such, MVP is designed around three items:
  • Model - The Model is the embodiment of the data or content that fills the UI.
  • View - The View is the visual layout and representation of the content.
  • Presenter - The Presenter is where we place all of the logic that drives the form.

The way these three items interact generally happens in one of two forms.
  • Supervising Controller - In this type of interaction, the View and the Model have a more direct interaction, while the Presenter simply "supervises". The direct interaction between the View and the Model is light, with the View using the Model for simple data-binding.
  • Passive View - In this type of interaction, the Presenter takes a far more active role while the View (as the name implies) takes a more passive role. The Presenter takes full responsibility for communicating Model information to the View and for modifying the Model in response to View events; the View usually knows nothing about the Model and is entirely dependent on the Presenter in order to get its data.

For DotNetNuke module developers, the Testable DNN Module template takes a Supervising Controller approach.

Passive View vs. Supervising Controller

More on MVP

To learn more about MVP, check out the following links.

Last edited Jul 3, 2010 at 6:03 AM by dagilleland, version 7


No comments yet.