Questions tagged [mvp]

Model View Presenter (MVP) is a derivative of the model-view-controller software pattern, used mostly for building user interfaces.

Model-view-presenter (MVP) is a derivative of the model-view-controller software pattern, used mostly for building user interfaces.

In MVP, the presenter assumes the functionality of the "middle-man" (played by the application controller in MVC). Additionally, the view is responsible for handling the UI events (like mouse down, key down, etc.), which used to be the controller's job. Eventually, the model becomes strictly a domain model.

Source: Wikipedia article Model–view–presenter

1962 questions
2351
votes
24 answers

What are MVP and MVC and what is the difference?

When looking beyond the RAD (drag-drop and configure) way of building user interfaces that many tools encourage you are likely to come across three design patterns called Model-View-Controller, Model-View-Presenter and Model-View-ViewModel. My…
241
votes
6 answers

What is difference between MVC, MVP & MVVM design pattern in terms of coding c#

If we search Google using the phrase "differences between MVC, MVP & MVVM design pattern" then we may get a few URL's which discuss the difference between MVC MVP & MVVM design pattern theoretically like: MVP Use in situations where binding via a…
Thomas
  • 33,544
  • 126
  • 357
  • 626
94
votes
3 answers

Model-View-Presenter in WinForms

I am trying to implement the MVP method for the first time, using WinForms. I am trying to understand the function of each layer. In my program I have a GUI button that when clicked upon opens a openfiledialog window. So using MVP, the GUI handles…
Darren Young
  • 10,972
  • 36
  • 91
  • 150
76
votes
4 answers

Android MVP: What is an Interactor?

What is an Interactor? How does it fit within the MVP Design? What are the advantages/disadvantages of using an interactor vs putting the interactor code in the presenter?
bkach
  • 1,431
  • 1
  • 15
  • 24
64
votes
6 answers

What are the differences between Presenter, Presentation Model, ViewModel and Controller?

I have a pretty good idea how each of these patterns work and know about some of the minor differences between them, but are they really all that different from each other? It seems to me that the Presenter, Presentation Model, ViewModel and…
64
votes
4 answers

What is Model View Presenter?

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 ?
bluediapente
  • 3,946
  • 5
  • 32
  • 38
60
votes
3 answers

Does the presenter having knowledge of the Activity / Context a bad idea in the MVP pattern?

I've been playing around with the MVP pattern for a few weeks now and I've come to the point where I need context to start a service and access Shared Preferences. I've read that the purpose of MVP is to decouple the view from the logic and having…
remedy.
  • 2,032
  • 3
  • 25
  • 48
46
votes
2 answers

Moq - mock.Raise should raise event in tested unit without having a Setup

I have a presenter class, that attaches an event of the injected view. Now I would like to test the presenter reacting correctly to the event. This is the view interface IView: public interface IView { event EventHandler MyEvent; void…
Yannik
  • 709
  • 1
  • 7
  • 11
44
votes
2 answers

MVC / MVP / MVVM What the Heck?

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…
Steve
  • 2,073
  • 4
  • 27
  • 39
41
votes
4 answers

How to use Shared Preferences in MVP without Dagger and not causing Presenter to be Context dependent?

I'm trying to implement MVP without Dagger (for learning purposes). But I got to the problem - I use Repository patter to get raw data either from cache (Shared Preferences) or network: Shared Prefs| …
39
votes
2 answers

MVP examples for Windows Forms

Is there good example code or a test project for explaining the Model–view–presenter (MVP) pattern. There are a lot of explanation links, but I want to have some good example code to show others without reinventing the wheel.
leora
  • 188,729
  • 360
  • 878
  • 1,366
38
votes
1 answer

MVP for Activity with multiple Fragments

I have an Activity with two Fragments in it. The activity (MainActivity) retrieves data from an open weather api. I have implemented MVP for this in which: Model contains all the response objects from the API View is the Activity Presenter contains…
DJ-DOO
  • 4,545
  • 15
  • 58
  • 98
38
votes
4 answers

What to use? MVC, MVP or MVVM or…?

I will start a Java project to develop a desktop application. What to use as presentation layer pattern (MVC, MVP,MVVM or....)? ...if it is possible, with some working small example... :-)
Andrea
  • 803
  • 1
  • 12
  • 27
38
votes
1 answer

Concrete Code Example of MVP

Can someone provide a concrete (actual Java code) example of MVP in action? This would include the following 3 types of classes and how they call each other's methods to achieve the pattern and process/respond to a client-side response: Model -…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
36
votes
4 answers

Android MVP - Should avoid using R.string references in presenter?

In an attempt to entirely decouple the Android SDK from my presenter classes, I'm trying to figure out the best way to avoid accessing resource IDs which we normally use R for. I thought I could just create an interface to access things like string…
Scott Merritt
  • 1,284
  • 2
  • 13
  • 24
1
2 3
99 100