The "No Mapping" Strategy
The first strategy is actually not mapping at all:
Figure 8.1: If the port interfaces use the domain model as the input and output model, we don't need to map between layers
The preceding figure shows the components that are relevant to the "Send Money" use case from our BuckPal example application.
In the web layer, the web controller calls the SendMoneyUseCase interface to execute the use case. This interface takes an Account object as an argument. This means that both the web layer and the application layer need access to the Account class – both are using the same model.
On the other side of the application, we have the same relationship between the persistence and application layers. Since all layers use the same model, we don't need to implement a mapping between them.
But what are the consequences of this design?
The web and persistence layers may have special requirements for their models. If our web layer exposes...