In MVP pattern the presenter acts upon the model and the view. It retrieves data from repositories (the model), and formats it for display in the view.
Questions tagged [presenter]
143 questions
125
votes
2 answers
Ruby on Rails patterns - decorator vs presenter
There is all sorts of talk lately in the Ruby on Rails community about decorators and presenters.
What is the essential difference between the two? If there is, what are the clues that tell me which one to use over the other? Or perhaps to use the…

keruilin
- 16,782
- 34
- 108
- 175
42
votes
3 answers
Show Dialog from ViewModel in Android MVVM Architecture
About MVVM with new architecture components, I've a question, how should I implement if my app needs to display for example a Dialog with 3 options from some action that happened in my VM? Who is responsible for sending to Activity/Fragment the…

lucasb.aquino
- 657
- 1
- 6
- 10
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
15
votes
1 answer
How to pass argument to delegate method in Rails
I would like to have a Dashboard to display summary of multiple models, and I implemented it using Presenter without its own data. I use an ActiveModel class (without data table):
class Dashboard
attr_accessor :user_id
def initialize(id)
…

AdamNYC
- 19,887
- 29
- 98
- 154
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
8
votes
1 answer
Model View Presenter - same view, different presenters
I'm building one Android app using MVP, and I have one question about this pattern.
Say I have one screen for creating a new person. This screen will show one EditText for inserting the name, another for the surname, one ImageView to show the picked…

GaRRaPeTa
- 5,459
- 4
- 37
- 61
7
votes
1 answer
Presenter mode of a Xaringan presentation does not sync
When I use Xaringan's presenter mode, the window (in chrome) showing the presenter mode and the window showing the normal view (another tab in chrome) are out of sync. IE, moving slides in the presenter mode window does not move the normal slides…

StarScream2010
- 241
- 1
- 5
6
votes
1 answer
Using rails presenters - memoizable getting deprecated in 3.1 - use ||= instead?
Issue: To avoid creating multiple objects or multiple queries when possible.
I am using Presenters with rails as a Best Practice.
I am following advice that says that it would be good to use "extend ActiveSupport.Memoizable" (and then memoize…

Michael Durrant
- 93,410
- 97
- 333
- 497
6
votes
2 answers
Derived Interface with derived interface member
I have 2 base interfaces, IViewBase (which all views will implement) and IPresenterBase (which all presenters will implement):
public interface IViewBase { }
public interface IPresenterBase
{
IViewBase View { get; set; }
}
Then i've created a…

Sys
- 443
- 1
- 8
- 28
5
votes
1 answer
How does Rails populate the "model_type" field for polymorphic associations?
I have an Activity model. It belongs_to :parent, :polymorphic => true.
Does Rails use parent.class.name, parent.model_name or something else to populate the parent_type field?
I want a Presenter to behave like the parent object it wraps, and I need…

Robin
- 21,667
- 10
- 62
- 85
5
votes
2 answers
In the MVP pattern, should adapters hold models or should the presenter hold models and have the adapter reference it?
Currently I have it so that an adapter has a reference to all the models in it. But is it better to let the presenter just hold the models and the adapter can simply reference them?
So for example:
public class Adapter extends…

Sree
- 2,727
- 3
- 29
- 47
4
votes
1 answer
clean architecture : can the preseter talk to to the controller?
in the clear architecture, what uncle bob suggested.
I have a lot of questions about how to correctly distribute the responsibility.
it seems that there is no relationship between controller and presenter.
the controller's job is to take the input…

rahul Kushwaha
- 2,395
- 7
- 32
- 64
4
votes
1 answer
In Ruby, how does one verify the identity of a Struct?
I've been trying to make sense of the class of self in the present method that Ryan Bates used in his Presenters RailsCast (#287 Presenters from Scratch (pro) - RailsCasts). In the video, Ryan says, 'Self is the template object which has all the…

Ginnie Hench
- 277
- 2
- 11
4
votes
2 answers
How many presenters should be used in Model View Presenter with Winforms with tabs?
I have a form with tabs related to a business entity - e.g. a Person has biographical data, address data, etc. Each tab handles input/editing of a category of Person data, and each tab can be saved independently. Should one presenter be used for…

Nick
- 41
- 2
4
votes
2 answers
Android - context with MVP
I'm about creating a simple app with MVP implementation, and trying to make a permission request in a presenter. To make a permission request, I need to pass Context like this.
// Location permission has not been granted yet, request it.
…

swordartist
- 302
- 2
- 3
- 8