End of Confusion: MVP vs MVC
The Model View Controller and Model View Presenter design pattern has been the source for a lot of confusion. Lately there has been a growing number of blog posts attempting to explain the when, what and why of this design pattern. Many developers unfamiliar to this pattern seem to be pushed back by the initial learning curve and complexity.
I have been following much of what has been written on this topic both on online forums and on blogs. If you are unfamiliar with MVP and are doing UI development I would strongly urge you to evaluate and study this pattern. It does not always pay to implement it and there are several flavors of MVP. Each flavor has strengths and weaknesses. But, IMHO, if you develop user interfaces, you need to be familiar with this design pattern.
If you are new to design patterns in general, there is one personal message that I would like to emphasize. I was first introduced to Design Patterns several years ago. It was early in my career, but I was no longer a junior programmer. Full of confidence I dived into this topic that was supposed to make me a better developer. There was however a difficulty I had to overcome that I would like to share.
I had mostly been working on medium sized projects. My interpretation of medium size is more than 6 months of development with 3-6 developers. Most, if not all of us were familiar with the principles of writing cohesive code and low coupling. The code was modular, well managed and in general I felt that for the most part it was high quality code.
At this point I was introduced to design patterns. My main problem was that it took significant time to unlearn certain practices I was familiar with. It took time to grok what all this extra complexity would bring to the table. And this is the main point. Until you become familiar with certain ways of doing things, it is pure added complexity. Once you get past this point and start to follow a set of principles and design patterns you'll find yourself writing highly consistent code. What was previously complex becomes second nature.
Back to the topic on Model View Presenter. As I stated in the beginning of this post, a lot has been written on this topic lately. Instead of repeating what others have written I'll instead point you to the sources I have enjoyed most.
Jeremy Miller has written a lot on the topic of Model View Presenter and Design Patterns in general. Development Trivial Pursuit: The difference between MVC and the different flavors of MVP is a pretty recent post, but if you search his blog you'll find tons of good content.
In his post MVC or MVP Pattern – What's the difference? Todd Snyder from Infragistics gives a good overview and compare and contrast the two.
Nicola Malovic offers a two part introduction to MVP. Part 1: Model View Presenter (MVP) Pattern Part 2: Model View Presenter (MVP) design pattern close look - Part 2 - Passive View.
If you want a lengthy, but thorough introduction and historical evolution of this pattern head over to An Introduction to the Model-View-Controller, Model-View-Presenter, and Presentation-Abstraction-Control Patterns by Derek Greer.