Model-View-Presenter (MVP)
A UI architectural pattern separating presentation, presentation logic and the data model.
Classification
- ComplexityMedium
- Impact areaTechnical
- Decision typeArchitectural
- Organizational maturityIntermediate
Technical context
Principles & goals
Use cases & scenarios
Compromises
- Presenter may become a complex business logic God object
- Improper interface definitions increase coupling
- Lack of discipline leads to mixed responsibilities
- Keep views as passive as possible; logic in the presenter.
- Write presenter unit tests before UI integration.
- Avoid business logic in the presenter; delegate to the domain layer.
I/O & resources
- UI specifications and user requirements
- Existing domain model / backend APIs
- Test infrastructure (unit tests, mocks)
- Separated presenter, view and model components
- Automated tests for presenters
- Defined interfaces and adapters
Description
Model-View-Presenter (MVP) is a UI architectural pattern separating presentation, logic, and data. The Presenter mediates between Model and View, improving testability and clearly separating responsibilities. MVP is suitable for complex user interfaces requiring reusable presentation logic, modular structure and reduced coupling.
✔Benefits
- Improved testability via isolated presenters
- Clear responsibility boundaries between UI and domain
- Reusable presentation logic across platforms
✖Limitations
- Can produce boilerplate through many interfaces
- Overuse can lead to too many presenter classes
- Not always optimal for simple, purely declarative UIs
Trade-offs
Metrics
- Presenter test coverage
Percentage of presenter functions covered by automated tests.
- Number of presenters per view
Measures modularity and granularity of the presentation layer.
- Time-to-change for UI (lead time)
Time required to implement and test a UI change.
Examples & implementations
Desktop application with clear presenter tests
A finance desktop application uses presenters to encapsulate complex input logic and enable automated tests.
Android app using the Mosby framework
An Android app implements MVP using the Mosby library to reuse presenter logic.
Refactoring a WinForms UI
Legacy WinForms code was gradually moved into presenters, improving testability.
Implementation steps
Identify views and extract UI logic into presenters.
Define clear interfaces between view and presenter.
Implement presenters with unit tests and use mocks for views/model.
Integrate presenters gradually into existing views and refactor iteratively.
⚠️ Technical debt & bottlenecks
Technical debt
- Unrefactored presenters with mixed logic
- Outdated adapters between presenter and model
- Missing test coverage in critical presenter paths
Known bottlenecks
Misuse examples
- Moving full domain logic into presenter instead of domain layer.
- Introducing MVP for very simple form views without benefit.
- Creating many fine-grained presenters with redundant responsibilities.
Typical traps
- Presenter becomes change bottleneck if too much responsibility is centralized.
- Unclear interface contracts lead to repeated refactoring.
- Missing tests allow creeping mixing of responsibilities.
Required skills
Architectural drivers
Constraints
- • Platform API may force passive views
- • UI framework constraints can influence presenter design
- • Team experience with pattern and test automation required