Presenters and View Models
Understand how Presenters format data from Use Cases into View Models suitable for display in the UI.
Presenting Data to Users
In Clean Architecture, the outermost layer is dedicated to frameworks and drivers, which includes our user interface (UI). How do we effectively get data from our core business logic (Use Cases) to display on the screen?
This is where Presenters and View Models step in. They act as crucial adapters, bridging the gap between your application's core and its visual representation.
The Presenter's Purpose
A Presenter is an intermediary responsible for preparing data for the UI. It receives the 'raw' output from a Use Case, which often consists of business entities or specific data transfer objects (DTOs) from the application layer.
- It transforms Use Case output into a UI-friendly format.
- It handles presentation logic, such as formatting dates or combining strings.
- It does NOT contain business rules or data access logic.
All lessons in this course
- Presenters and View Models
- Adapting to Web Frameworks
- Testing the Presentation Layer
- Humble Objects and the View Boundary