Hot answers tagged

64 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 | +...
user avatar
  • 125k
39 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, ...
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 ...
user avatar
  • 27.2k
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 must be a Model layer, a ...
user avatar
  • 186k
12 votes
Accepted

Who communicates with the database in MVC/MVP?

I've seen it done two ways. The first way is to do everything using CRUD methods. That's essentially the way you are describing: Create, Read, Update and Delete. Most Object-Relational Mappers (ORM'...
user avatar
8 votes
Accepted

In MVP pattern should the View instantiate a Model object based on UI contents, or just pass these contents as parameters to the Presenter?

According to Martin Fowler's description of MVP ( http://martinfowler.com/eaaDev/uiArchs.html ) Of the View portion of MVC, Fowler says: The first element of Potel is to treat the view as a structure ...
user avatar
  • 9,706
8 votes
Accepted

How can one presenter be used for multiple views in MVP

Yes, it is fine. Applying MVP design pattern means having MVP triplets (model-presenter-view) per every (even a bit complex) item to display. The logic goes to the model, and the presenter is there ...
user avatar
  • 13.9k
7 votes

how can the presenter or view interact with the model in the MVP pattern?

In the MVP pattern is the View is "dumb". It doesn't really do anything. The presenter acts as the controlling object in the heirarchy, while the Model stores the data and has business logic methods ...
user avatar
  • 8,640
7 votes

Proper Model-View-_____ design

Your phrase "Is the coordinator and translator between the Model and the View." indicates that your Bridge is the Presenter in an MVP architecture. MVP and MVC are very similar, except ...
user avatar
  • 4,847
7 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. ...
user avatar
  • 1,946
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 ...
user avatar
  • 186k
6 votes
Accepted

UI Design patterns for non-screen based project

When the HTTP request is completed, it will return some data, and the model gets updated by the responsible part of your system. Then raise an event which tells everyone who subscribed to it "new data ...
user avatar
  • 186k
6 votes
Accepted

Showing a View from another View in MVP

Displaying a second view on btnShowView2.Clicked is some kind of business logic, so the right place for implementing this is in the event handler of presenter1 which deals with that event (I assume ...
user avatar
  • 186k
6 votes

Proper Model-View-_____ design

I suspect one of the things that's confusing you is that there are two entirely different patterns that are both commonly called model-view-controller. There's the original, as implemented in ...
user avatar
  • 17.3k
6 votes
Accepted

MVP (Supervising Controller) Does the view update the model?

There are several variants of the MVP around since its original design in 1996 by Mike Potel. Martin Fowler discusses some of them in another article on GUI architecture. One of the key differences ...
user avatar
  • 68.6k
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 (...
user avatar
5 votes
Accepted

Communication between Multiple Presenters in MVP

In my experience, if a result is needed in multiple places in the user interface, this suggests to me that the method for calculating it is a universal business rule, and therefore that rule has no ...
user avatar
  • 17.3k
5 votes

Is Model-View-Presenter (MVP) scheme useful for Android?

MVP is definitely useful for Android. It helps to organise and unit test your code. And the best part is new people reading your code will be able to understand the code and will start contributing ...
user avatar
5 votes
Accepted

In the MVP pattern, the Presenter must control the call flow of Model methods?

The method could be part of the presenter, it could stay in the model, or it could be moved to a separate helper or controller class. None of these placements is always "better" or "best practice". ...
user avatar
  • 186k
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. ...
user avatar
  • 68.6k
5 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 ...
user avatar
  • 11.5k
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 ...
user avatar
4 votes

In the MVP pattern, the Presenter must control the call flow of Model methods?

Leave createRoom in the model. Throw MVP out the window for a minute, and look at this list: {createRoom, displayRoomToUser, addUsersToRoom, joinRoom}. Which method isn't like the others? Obviously ...
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 ...
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 ...
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-...
user avatar
  • 68.6k
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 ...
user avatar
  • 769
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 ...
user avatar
  • 1,067
3 votes
Accepted

Why are interfaces necessary in MVP design pattern?

Interfaces are required in good quality implementations of MVP for the same reason they are required in all good "OO" designs: They help reduce coupling They discourage inheritance (which further ...
user avatar
  • 38.3k
3 votes

how can the presenter or view interact with the model in the MVP pattern?

In both MVP flavours, Passive View and Supervising Controller, the presenter handles the input logic and other complex view logic. So the download control logic should definitely go into the presenter....
user avatar
  • 409

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