Model-View-Presenter (MVP) Software Architecture Pattern
(Redirected from Model-View-Presenter Architecture Pattern)
Jump to navigation
Jump to search
A Model-View-Presenter (MVP) Software Architecture Pattern is a front-end software architecture pattern that separates information representation from user interaction.
- Context:
- It can be related to a model–view–controller pattern where the presenter assumes the functionality of the middle-role.
- It can be followed by an MVC Platform.
- …
- Counter-Example(s):
- See: MVVM Pattern, Web Application Framework, Scala Play Platform.
References
2013
- chat
- Model-View-Presenter (MVP) is a software architectural pattern commonly used for designing user interfaces. It is similar to the Model-View-Controller (MVC) pattern, but there are some key differences. MVP aims to separate the responsibilities of managing the data, handling user interactions, and updating the UI more distinctly.
- In MVP, the components are as follows:
- Model: Represents the data and business logic of the application, just like in MVC. It's responsible for retrieving and storing data, as well as performing any necessary data processing.
- View: Displays the data from the Model to the user and receives user inputs. It is a passive component that is not aware of the Presenter and only communicates through an interface.
- Presenter: Acts as an intermediary between the Model and View. It handles user inputs from the View, processes them (possibly updating the Model), and then updates the View accordingly. The Presenter is responsible for coordinating the flow of data between the Model and the View.
- The main differences between MVP and MVC are:
- In MVC, the Controller is responsible for both handling user input and updating the View. In MVP, these responsibilities are separated, with the Presenter handling user input and updating the View.
- In MVP, the View is more passive, and it communicates with the Presenter through an interface. This allows for easier unit testing and a clearer separation of concerns.
- To interface with a microservice backend, an MVP-based application would typically use an API Gateway or a similar communication method. The Model component would communicate with the microservices through the API Gateway, sending requests and receiving responses. The data retrieved from the microservices would then be processed by the Model and presented to the user via the View, with the Presenter coordinating these interactions.
2022
- (Wikipedia, 2022) ⇒ https://en.wikipedia.org/wiki/Model–view–presenter Retrieved:2022-11-21.
- Model–view–presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern, and is used mostly for building user interfaces.
In MVP, the presenter assumes the functionality of the "middle-man". In MVP, all presentation logic is pushed to the presenter.
- Model–view–presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern, and is used mostly for building user interfaces.