Monday, February 8, 2016

MVC, MVP & MVVM - Architectural Patterns.



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.
MVC - Framework Library: Early web MVC frameworks took a thin client approach that placed almost the entire model, view and controller logic on the server. This is still reflected in popular frameworks such as Ruby on Rails, Django, ASP.NET MVC, Spring MVC and Express. Client technologies have matured; frameworks such as AngularJS, EmberJS, JavaScriptMVC, SpineJS and Backbone have been created that allow the MVC components to execute partly on the client.

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

MVVM - Model–View–ViewModel (MVVM) is a software architectural pattern. MVVM and Presentation Model both derive from the model–view–controller pattern (MVC). MVVM facilitates a separation of development of the graphical user interface (either as markup language or GUI code) from development of the business logic or back-end logic (the data model). Model–view–viewmodel is called model–view–binder, especially in implementations not involving the .NET platform. ZK (a web application framework written in Java) and KnockoutJS (a JavaScript library) use model–view–binder. The MVVM pattern includes three key parts:
  1. Model (Business rule, data access, model classes)
  2. View (User interface (XAML))
  3. ViewModel (Agent or middle man between view and model)
 
MVVM - Framework Library: Client side - Knockout.js, Kendo (MVVM) whereas Server side - WPF (Desk­top) or Sil­verlight, Win­dows 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 deriv­a­tives of MVC (see time­lines and how these have evolved). The key dif­fer­ence between them is the depen­dency each layer has on other lay­ers as well as how tightly bound they are to each other. 

2 comments:

  1. It was certainly interesting for me to read that article. Thanx for it. I like such topics and anything that is connected to this matter. I definitely want to read more on that blog soon.

    Cloud platform as a service

    ReplyDelete
  2. BlueHost is ultimately one of the best hosting company with plans for any hosting requirements.

    ReplyDelete