Similarities

  • All three architectures are designed to separate view from model. Model handles domain and business logic, view handles presentation
  • Controller/Presenter/ViewModel handle communication with Model and View
  • Model always communicates by firing events, so┬ádisplay is not waiting for a response

Differences

  • Presenter and ViewModel have 2-way communication with View and Model. Controller listens to View and updates Model
  • In MVC, Model communicates with View directly through events. In MVVM and MVP, model communicates with View through Presenter or ViewModel
  • MVP has single presenter for each view. MVVM has a single VieModel for each view also, but goes a step further and has a tight coupling between the two, so the fields, etc would align. MVC has multiple views for each controller, and the controller decides which view will show up next, and also manipulates the model.
  • Presenter updates the view directly by calling the fields to be updated. ViewModel updates the view by using an observer pattern.

Examples

  • MVP – WinForms
  • MVC – ASP.Net MVC site
  • MVVM – WPF

References

Advertisements