Skip to main content
66 votes

What are the improvements of MVP over MVC?

MVC is conceptually elegant: user input is handled by the controller the controller updates the model the model updates the view/user interface +---+ +----| V |<----+ user | +...
amon's user avatar
  • 135k
43 votes
Accepted

Clean Architecture - Too many Use Case Classes

Do I really have to make 24 use cases? Only if everything you write is CRUD. Refer to the diagram below: Your assertion is that you will have six different entities, and 4 methods (Create, Read, ...
Robert Harvey's user avatar
18 votes
Accepted

Patterns are not building blocks – so I shouldn't build an app on MVC/MVP patterns?

If I understand correctly, this means not to use a design pattern until it makes sense to do so, correct? Yes. Don't start off saying you're going to use the Strategy Pattern, wait until you ...
Ixrec's user avatar
  • 27.7k
16 votes
Accepted

What is the difference between MVP and clean architecture

What Bob Martin called "Clean Architecture" is more a "meta architecture", a high level guideline for creating layered architectures. It does not say anything like "There ...
Doc Brown's user avatar
  • 210k
7 votes
Accepted

Model View Presenter pattern with passive view. Who is responsible for setting the labels' texts?

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second one allows some things the first one does not, so you have to analyse ...
Doc Brown's user avatar
  • 210k
6 votes

What are the improvements of MVP over MVC?

In MVP, the Presenter replaces MVC's Controller. The difference between the two is that the Presenter directly manipulates the View. It is designed for UI frameworks that are primarily event driven (...
Michael Brown's user avatar
6 votes
Accepted

How many presenters should I use in proper MVP?

Making the Presenters be dependent one one another does not sound right. The dependencies are such that you will need all the Views and all the Presenters to make one pair of View and Presenter work. ...
R Sahu's user avatar
  • 1,986
6 votes

In MVP, should we call repositories from the Model or the Presenter?

In my experience it depends on who you ask (but it shouldn't). I've seen your question asked about MVC, MVP, and MVVM. There is confusion about all three. But why is that? This is mainly the ...
MetaFight's user avatar
  • 11.6k
6 votes

Concrete implementation of MVP with "dumb" view

I like the idea of having a "dumb" view to be able to cover as much of the code with unit tests. I like the idea as well. It follows a pattern Martin Fowler called the Humble Object which ...
candied_orange's user avatar
5 votes
Accepted

Good analogy for MVP and MVC patterns?

There are 3 main variants of the same basic pattern: Model-View-Controller: The granddaddy of them all. Originally defined with Smalltalk Model-View-Presenter: Variant created primarily to deal with ...
Berin Loritsch's user avatar
5 votes
Accepted

In MVP, should we call repositories from the Model or the Presenter?

In an MVP model, the presenter acts as middleman between the view and the model. In consequence, from the presenter you shall call the model and not short- circuit it by calling repository directly. ...
Christophe's user avatar
  • 78.7k
5 votes
Accepted

Passing data through events to adhere to the Tell-Don't-Ask principle?

But, I see nobody using code like: public event Action<object, string, string?>? SearchInAlbums; Instead, they all use: public event EventHandler SearchInAlbums; //or something similar By ...
Doc Brown's user avatar
  • 210k
5 votes
Accepted

How to structure libraries/solution for Onion Architecture with Model View Presenter pattern?

Interface.Presenters would have to reference Framework.Views Have you seen this? Clean Architecture by Robert Cecil Martin This shows the static dependencies still pointing inward across the layers....
candied_orange's user avatar
4 votes

Is 20 Java classes for just making a REST call too much?

Is 20 Java classes for just making... This is entirely the wrong question. Something is wrong or you wouldn't be asking. It sounds like you're looking for something to blame. Anguishing over the ...
candied_orange's user avatar
4 votes

Is it bad practice to have calculations in the Presenter/Controller and View

"Best practice" is usually short hand for "whatever matches my prejudices". It's not an objective evaluation, and specific cases may require a departure from best practice... So, here are my ...
Neville Kuyt's user avatar
4 votes
Accepted

In MVP, should the View have access to Domain objects?

The key principle in the MVP architecture (initially introduced by Talligent in 1996), is that the presenter acts as middleman between the view and the model. The underlying idea is that in a client-...
Christophe's user avatar
  • 78.7k
4 votes

Clean Architecture - Too many Use Case Classes

You are right if every CRUD-Operation is translated in one UseCase. But a UseCase may also consist of multiple CRUD-Operations. A UseCase is a separated model gathers information from different data ...
oopexpert's user avatar
  • 779
4 votes
Accepted

In MVP, should the View expose the controls themselves or just their values?

Creating automated tests for your components will be much easier if you code to interfaces (instead of concrete classes) of the model and the view. Now rethink your question: do you want to expose the ...
Hero Wanders's user avatar
  • 1,077
4 votes

How to structure libraries/solution for Onion Architecture with Model View Presenter pattern?

I'm going to take your questions in reverse order. How to structure your projects Don't have a project per layer. Make you projects individual components like a repository or a web front end, or a ...
Ewan's user avatar
  • 77.4k
3 votes
Accepted

Should the presenter access view data via properties or event parameters?

The event data approach will keep you a little closer to the observer pattern, but you should probably not create (or instantiate) Employee from within the view. It's almost like you're directly ...
Silviu-Marian's user avatar
3 votes

In the MVP architecture, how should the Model layer get its data?

The MVP pattern basically separates the model, from a view through a presenter. Here, the presenter listens for any user interaction through the view. The presenter then fetches the relevant info from ...
Navneet Krishna's user avatar
3 votes

Is it bad practice to have calculations in the Presenter/Controller and View

It is preferable to do this calculation in the domain model. Developers often overlook plural business entities... ProductCollection.TotalPrice With that said, I don't think it's bad to do a simple ...
TheCatWhisperer's user avatar
3 votes

I have a few questions about the MVP pattern in a WinForms project

Is a form a View?/ Can a form be a View? Which derives from a IFormView class Yes. Precisely. Does each form have their own Presenter? If not, how is this organized instead? That is ...
RubberDuck's user avatar
  • 8,971
3 votes

PHP MVC/PAC - Logged In/Admin checks placement

Authentication should happen after routing but before calling controller or its methods. At that point you know which route was requested and can check if user has privileges to perform a certain ...
potfur's user avatar
  • 479
3 votes

Clean Architecture - Too many Use Case Classes

It's assumed that clean architecture is used in business heavy applications, where use cases are mapped to business rules. In a CRUD app it's over-engineering. Here you can use facade and map requests ...
photostok's user avatar
3 votes
Accepted

Question on MVP Pattern, Events and saving complex objects

I would segregate the persistent data to DTO's that are consumed and produced by full blown long lived objects that were taught what handlers existed were when they were constructed. Done this way ...
candied_orange's user avatar
2 votes

How to manage state in MVP pattern?

I'm not sure if this is a complete answer, but at least it's a start: for the pagination with the RecycleView you need to listen on the onScroll event please refer to this for more info: https://...
gmansour's user avatar
  • 171
2 votes

PHP MVC/PAC - Logged In/Admin checks placement

I'm from the Java World, but things are pretty similar, so here are some hints about rights checking in my opinion. If your right is a right like "have the right to perform action X". Then you should ...
Walfrat's user avatar
  • 3,516
2 votes
Accepted

Loose Coupling Presenter to View in MVP

Occam's razor says I need arguments to use decoupling, and testing doesn't seem to be one of them. Why should we use a decoupled model and pay the price for it? MVVM imposes the (artificial) ...
Robert Bräutigam's user avatar
2 votes

Is it wrong to pass the concrete Model through the View to the Presenter with MVP 'Passive View'

It seems like you have tried to implement a dependency injection mechanism in the Presenter, but failed to do so in the View. The point of MVP, especially Passive-View MVP, is that the View is as ...
Michael Haddad's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible