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
34
votes
4 answers

Android MVP open Activity from Presenter, anti-pattern?

Would it be an anti-pattern if from a Presenter layer I open an Activity? If so, should I manage the navigation of the app from the View Layer?
Jose M Lechon
  • 5,766
  • 6
  • 44
  • 60
34
votes
10 answers

What Alternatives Are There to Model-View-Controller?

While going through university and from following the development of SO, I've heard a lot about the Model-View-Controller architectural design pattern. I inadvertently used the MVC pattern even before I knew what it was, and still use it in my…
Aaron
  • 23,450
  • 10
  • 49
  • 48
34
votes
3 answers

In MVP where to write validations

In Model-View-Presenter pattern where should we write validations of user input.
Prabu
  • 2,313
  • 2
  • 28
  • 31
33
votes
2 answers

How to unit test Kotlin suspending functions

I follow the MVP pattern + UseCases to interact with a Model layer. This is a method in a Presenter I want to test: fun loadPreviews() { launch(UI) { val items = previewsUseCase.getPreviews() // a suspending function …
Nikolay Kulachenko
  • 4,604
  • 4
  • 31
  • 37
31
votes
5 answers

Does Presenter in Model-View-Presenter create views?

How are Views created in MVP? Does the Presenter always create them (in addition to View in case of subviews)? Or is it a separate third-party component or App or something that creates them? Let's also add that I'm probably going to do this on Dojo…
Tower
  • 98,741
  • 129
  • 357
  • 507
28
votes
4 answers

android model view presenter/controller examples

are there any good examples or tutorials on how best to structure an android applications anywhere? am new to java and android and i've built winforms apps using passive and supervising controller variants of model view presenter and model view…
solrevdev
  • 8,863
  • 11
  • 41
  • 49
27
votes
6 answers

in MVC/MVP/MVPC where do you put your business logic?

in the MVC/MVP/MVPC design pattern where do you put your business logic? No, I do not mean the ASP.NET MVC Framework (aka "Tag Soup"). Some people say you should put it in the "Controller" in MVC/MVPC or "Presenter". But, others think it should be…
Patrick From An IBank
27
votes
6 answers

Android MVP - How to communicate between activity presenter and fragment presenter

I have an activity with 3 fragments, currently I use ViewPager. I want to implement MVP and communicate between activity presenter and fragment presenters i.e: Passing data from activity presenter to fragment presenters Sending event from fragment…
Norutan
  • 1,480
  • 2
  • 14
  • 27
27
votes
1 answer

Why aren't the MVP and MVVM patterns seen in Ruby, Python, or PHP?

I've been reading about these and they're pretty prominent in the .NET world. Why aren't there any web frameworks that implement any of these patterns in Ruby, Python, or PHP? Is it because it only works with component-based frameworks, like…
ryeguy
  • 65,519
  • 58
  • 198
  • 260
26
votes
4 answers

Files structure in MVVM (Android)

using MVVM or MVP should i name packages like model, viewmodel, view and put proper classes and interfaces there or is it just a logical structure that should not be visible in classes structure?
Jakub Kwiatek
  • 263
  • 1
  • 3
  • 6
26
votes
5 answers

InvalidCastException for two Objects of the same type

I have this weird problem that I cannot handle myself. A class in the model of my mvp-project designed as singleton causes an InvalidCastException. The source of error is found in this code line where the deserialised object is assigned to the…
LLEA
  • 345
  • 1
  • 4
  • 7
26
votes
3 answers

MVP pattern with Javascript framework?

Has anyone been able to implement the MVP model with any javascript frameworks? I'm having trouble figuring out how to have the presenter -> view inversion from server code to javascript. I have some ideas, but kind of hackish and would like to see…
CriosR
25
votes
5 answers

What's your recommendation for architecting GWT applications? MVC, MVP or custom messaging solution?

I just started a new GWT project for a client and I'm interested in hearing people's experience with various GWT MVC architectures. On a recent project, I used both GXT MVC, as well as a custom messaging solution (based on Appcelerator's MQ). GXT…
Matt Raible
  • 8,187
  • 9
  • 61
  • 120
23
votes
3 answers

What's the best way to check for permissions at runtime using MVP architecture?

I'm developing an android app in which I have to ask for permissions at runtime. I'm wondering about the best way to implement that using Model-View-Presenter architecture. My initial thought was to have the presenter call a component responsible…
Mateus Gondim
  • 5,362
  • 6
  • 31
  • 51
22
votes
3 answers

MVP Communication between presenters?

I have a question about how to handle communication between presenters when using MVP. Say I have two MVP-triads. One is a list of products (Triad A) and the other is some general information about the currently selected product (Triad B). How do I…
user1277327
  • 411
  • 1
  • 4
  • 9