Question

I'm trying to understand whether there's a difference between the Model-View-Presenter and Model-View-Adapter patterns, and--if so--what that difference is. I haven't found any online resources that compare/contrast them, so I'm not even sure whether they're actually distinct.

The descriptions I've found of them sound essentially identical to me. From what I've gathered, in both cases the control flow is basically:

View <-- Adapter/Presenter --> Model
(where Adapter/Presenter can also respond to events from View and Model)

View: the UI
Adapter/Presenter: main logic; mediator between the UI and the data model
Model: the data model

The Adapter/Presenter "knows about" the View and the Model, but the View and the Model don't know about anyone other than themselves.

I expect that there's a subtlety that I'm completely missing here. What is it?

Was it helpful?

Solution

The only thing I can think of is MVA is generally associated with having multiple adapters between a view and model. While there's nothing stopping you from doing that in MVP, I think MVP implies a strong triad.

Update (years later): in retrospect, I believe a key difference would be control flow. In MVP, the View triggers/creates/calls the Presenter, which delegates to the model and responds back to the View. In MVA, when messages come in, an Adapter is chosen, which then mediates between the Model and View. Because the MVP View triggers/creates/calls the Presenter, choosing between multiple Presenters (as an Adapter is chosen) is not a straightforward fit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top