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
12
votes
3 answers

Android MVP pattern package structure

I saw various great tutorials on MVP pattern in android, but the authors all seem to have different practice on packaging. The first tutorial I saw did the packaging by functionalities. Such as, "Login", "Join", "UI" package. The UI package has…
March3April4
  • 2,131
  • 1
  • 18
  • 37
12
votes
2 answers

Scaling gwt's "Contacts" (sample project) AppController with MVP

I'm just learning GWT so I'm still trying to sort out all of its quirks and features. I'm reading through the example they give illustrating the MVP pattern, and I pretty much get it, except I'm wondering about one thing. The AppController they use…
brad
  • 31,987
  • 28
  • 102
  • 155
12
votes
0 answers

Model View Presenter nesting

I've run into a scenario which requires nesting of the MVP pattern. It is probably best to explain using a visual example: ------------------------------ | [View] | | | | | +----[Presenter] | | …
Thick_propheT
  • 1,003
  • 2
  • 10
  • 29
12
votes
2 answers

Isn't Cocoa MVC really MVP?

Once again, an MVC-related question. A few days ago I started reading the Cocoa Fundamentals Guide from Apple in which Apple explains their implementation of MVC. In the chapter MVC as a Compound Design Pattern (link), they compare two…
Thomas Smith
  • 439
  • 4
  • 11
11
votes
2 answers

GWT 2.2 MVP vs. GWT 2.1 Activities-Places

I'm starting to develop a large GWT application, and after reading a lot of articles and blog posts, I'm trying to understand what is the difference between the 2.2 Model-View-Presenter and the 2.1 Activities-Places design patterns? Which pattern do…
Tom Teman
  • 1,975
  • 3
  • 28
  • 43
11
votes
3 answers

Should Interfaces Live In The Same Namespace As The Concrete Classes That Implement Them?

Is there a standard for how solutions/projects are organized in regards to interfaces and the classes that implement them? I'm working on a an MVP, DDD application and would love to hear feedback as to how others layout their projects and why they…
Cognitronic
  • 1,426
  • 2
  • 16
  • 29
11
votes
2 answers

Implement onItemClickListener using MVP pattern

I am learning MVP and got confused where and how should I implement onClickListener while not ruining mvp concept here. Followed this guide: https://android.jlelse.eu/recyclerview-in-mvp-passive-views-approach-8dd74633158 My…
JoshuaMad
  • 577
  • 1
  • 7
  • 20
11
votes
2 answers

Does the MVP framework included in GWT 2.1 make other GWT MVP frameworks redundant?

GWT 2.1 includes an MVP framework which includes an implementation of the PlaceService outlined by Google's Ray Ryan at Google I/O 2009. That talk inspired some MVP frameworks like GWT-presenter GWT-Platform (GWTP) MVP4G Does GWT 2.1 make using…
boardtc
  • 1,304
  • 1
  • 15
  • 20
11
votes
2 answers

MVP Adapter Data Cache

I'm developing project following MVP architecture. Usually, when I use recyclerView, my presenter controls Adapter data. But now I need to make recycler adapter with data from cache (or something like cache), recycler's size dosen't depends on cache…
shagi
  • 629
  • 8
  • 25
11
votes
4 answers

Recovering presenters for the ViewPager fragments (MVP)

I'm trying to refactor an existing application to use the MVP architecture. One of the activities has a ViewPager with three fragments. Each fragment is linked with a presenter. To be precise - each presenter, when created, is given a View to work…
vkislicins
  • 3,331
  • 3
  • 32
  • 62
11
votes
1 answer

Internet check, where to place when using MVP, RX and Retrofit

I have went through this and this post. So I really agree with the second post that presenter should not be aware of android specific thing. So what I am thinking is putting internet check in service layer. I am using Rx Java for making network…
Akhil Dad
  • 1,804
  • 22
  • 35
11
votes
4 answers

Is there RxJava equivalent of Handler.postDelayed(Runnable r, long delayMillis)

I am trying to invoke a method that returns void (Java primitive type). I would like to delay the invoking of a it by a predefined amount of milliseconds. I know this can be simply done using a Handler by I prefer not to use it. I tried to…
R. Zagórski
  • 20,020
  • 5
  • 65
  • 90
11
votes
2 answers

Presenter injection with Dagger 2

I just started using Dagger 2 and I found online thousands guides each one with a different implementation and I'm a bit confused now. So basically this is what I wrote at the moment: AppModule.java: @Module public class AppModule { Application…
user1341300
  • 375
  • 1
  • 5
  • 19
11
votes
2 answers

Where should the android service calls and calls to GoogleAPIClient be written while using MVP pattern in android?

I am trying to implement MVP pattern in my android project by referring to this link : https://github.com/jpotts18/android-mvp I have successfully implemented the view / presenter / interactor classes. I am not clear on Where to put the service…
11
votes
1 answer

How do I start a service from my Interactor using the MVP pattern in android?

I'm following the Model View Presenter (MVP) pattern similar to Antonio Leiva's example found here: antoniolg/github. I've been playing around with it quite a bit and I was wondering how I would start a service from the interactor layer. Normally…
remedy.
  • 2,032
  • 3
  • 25
  • 48