Model-View-Adapter

Model-View-Presenter

Definition
A UI pattern that separates the visual representation (View) from the domain model (Model), and provides a controller (Adapter), that works as an intermediary between them. The view does not access the model.
Model-View-Adapter architecture diagram

The model contains the data and the domain logic of the application.

The view is the visual representation of the component that allows the user to interact with the application.

The adapter, like the controller, provides the wiring of the application: reading from the UI, writing to the model, error handling, navigation. It also adapts model data to be used by the view.

Examples

  • The Python framework, using Jinja 2 as templating engine

When should you use it?

It makes the view more reusable than MVC. Preparing the data by the adapter for the view is a bit more work than allowing the view to access it directly, but it helps to think about the performance of the data retrieval, since it is concentrated in one place.

Links