Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Model View Presenter? [closed]

Can someone please explain in a way as simple as possible what the Model View Presenter pattern is? What is the difference with Model View Controller ? Which is best or for which purpose ?

like image 531
bluediapente Avatar asked Aug 23 '09 03:08

bluediapente


People also ask

How does Model View Presenter work?

Data (model) and UI (view), only communicate with one another through an intermediary (the presenter) . The presenter contains the bulk of the business logic, while the view focuses on how to display the data. The controller responsibility is now split between the view and presenter.

Where is Modelview presenter used?

Model–view–presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern, and is used mostly for building user interfaces.

What is presenter in MVP Android?

The role of the Presenter class is to keep the business logic of the application away from the activity. Below is the complete step-by-step implementation of this android application. Note that we are going to implement the project using both Java and Kotlin language.


1 Answers

Model View Presenter and Model View Controller both try to solve the same "seperation of concerns" problem.

The primary difference you'll find is that Model View Controller (MVC) is often implemented with some coupling between the view and some model of some sort - thereby a given view is specifically purposed to provide a visualization of a given object (model).

In the Model View Presenter pattern you generally find that the Presenter takes care of working with the model, and deciding what information from it will be needed to form some sort of visualization.

In this diagram, arrows represent dependencies:

MVC and MVP dependencies

Typically you hear this pattern discussion come up when discussing the ASP.NET MVC framework, and come across information regarding the MVP pattern and it's implementation in ASP.NET WebForms. It is common in my experience that it is believed that WebForms is in and of itself an MVP patterned framework - this is not true. WebForms does however make it very easy to implement an MVP pattern - your best resource for this would be to investigate the Web Client Software Factory from the Patterns and Practices team.

like image 87
apiguy Avatar answered Oct 10 '22 09:10

apiguy