I recently worked on a .Net WPF project to build a retail point of sale system where I used the MVP pattern for the first time. It took me a little while to wrap my head around the change of approach but once I did that I thought that the concept rocked!
My question is this: what is the distinction between MVC, MVP and MVVM? If there is a clear distinction, are there guidelines as to when you should use one pattern over another?
If anyone can offer guidance on this, or point to article that explains the differences I'd very much appreciate it.
MVC (Model — View — Controller), MVP (Model — View — Presenter), and MVVM (Model — View — ViewModel) is the most popular and industry-recognized android architecture pattern among developers.
References — In MVC, the View doesn't have reference to the Controller while in MVP, the View has reference to the presenter and in MVVM, the View has reference to the View-Model. Entry Point — For MVC, the entry point to the application is the Controller whereas, for MVP and MVVM, the entry point is the View.
MVC (Model — View — Controller) and MVP (Model — View — Presenter) are the two most popular android architectures among developers.
MVC (Model — View — Controller) and MVVM (Model — View — ViewModel) are the two most popular android architectures among developers.
It can be hard to grok the differences between patterns by looking at a particular pattern implemented in a particular framework. This msdn article WPF MVVM makes reference to Martin Fowlers original articles which explain a pattern as a general approach:
Back in 2004, Martin Fowler published an article about a pattern named Presentation Model (PM) [...] consider MVVM to be a specialization of the more general PM pattern, tailor-made for the WPF and Silverlight platforms.
So to understand different patterns it is useful to look at Martin Fowler's descriptions of different approaches. His Passive View pattern is the MVP approach. His Supervising Controller pattern is the MVC approach. His Presentation Model pattern is the MVVM approach. This older article takes about the evolution of such patterns.
It may also help to look at implementations in different languages. The article Implementing event-driven GUI patterns using the ZK Java AJAX framework contrasts the three of Martin Fowler patterns mentioned above in a modern Java framework. Even though its a different language and a different framework from WPF it may help to see the pattern rather than the implementation of the pattern to see it done in a different language.
Microsoft's Application Architecture Guide describes MVC and MVP, and explores the differences between the two.
http://www.codeplex.com/AppArch
This MSDN article describes MVVM and it's evolution.
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With