MVC - Model–View–Controller (MVC) is a software architectural pattern mostly (but not exclusively) for implementing user interfaces on computers. Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become extremely popular for designing web applications.
MVP - Model-View-Presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern, and is used mostly for building user interfaces. MVP is a user interface architectural pattern engineered to facilitate automated unit testing and improve the separation of concerns in presentation logic:
- the view is a passive interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data.
- the model is an interface defining the data to be displayed or otherwise acted upon in the user interface.
- the presenter acts upon the model and the view. It retrieves data from repositories (the model), and formats it for display in the view.
MVP - Framework Library: Client Side- Riot.js, GWT whereas Server Side - Classic ASP.NET, JSP Servlets. In general implementation of MVP:
- .Net Framework - Claymore, MVC# Framework, Web Client Software Factory, Evolution.Net MVP Framework, ASP.NET Web Forms Model-View-Presenter (MVP), Nucleo.NET, WinForms MVP
- Java Framework - JavaFX, MVP4J, Echo2, Google Web Toolkit, GWT-Platform, JFace, Swing, Vaadin, ZK
- PHP Framework - Nette Framework
- Model (Business rule, data access, model classes)
- View (User interface (XAML))
- ViewModel (Agent or middle man between view and model)
MVVM - Framework Library: Client side - Knockout.js, Kendo (MVVM) whereas Server side - WPF (Desktop) or Silverlight, Windows Phone apps (XAML), Adobe Flex.
When to use which?
- MVC - Use in situations where the connection between the view and the rest of theprogram is not always available (and you can’t effectively employ MVVM or MVP)
- MVP - Use in situations where binding via a datacontext is not possible.
- MVVM - Use in situations where binding via a datacontext is possible.
Both MVP and MVVM are derivatives of MVC (see timelines and how these have evolved). The key difference between them is the dependency each layer has on other layers as well as how tightly bound they are to each other.