MVP vs. MVC Patterns

I recently read an article that mentioned the Model View Presenter MVP pattern.  This was the first time I’ve seen a reference to this pattern and was curious how it was different than the Model View Controller MVC pattern.  The article below offers a great explanation of the two as well as the differences.

Here’s the MVP pattern:

And the MVC Pattern:

Key Differences

So what really are the differences between the MVC and MVP pattern. Actually there are not a whole lot of differences between them. Both patterns focus on separating responsibility across multi components and promote loosely coupling the UI (View) from the business layer (Model).  The major differences are how the pattern is implemented and in some advanced scenarios you need both presenters and controllers.

Here are the key differences between the patterns:

  • MVP Pattern
    • View is more loosely coupled to the model. The presenter is responsible for binding the model to the view.
    • Easier to unit test because interaction with the view is through an interface
    • Usually view to presenter map one to one. Complex views may have multi presenters.
  • MVC Pattern
    • Controller are based on behaviors and can be shared across views
    • Can be responsible for determining which view to display (Front Controller Pattern)

Hopefully you found this post interesting and it helped clarify the differences between the MVC and MVP pattern. If not, do not be discouraged patterns are powerful tools that can be hard to use sometimes. One thing to remember is that a pattern is a blue print and not an out of the box solutions. Developers should use them as a guide and modify the implementation according to their problem domain.