The “Full” mapping strategy
Another mapping strategy is what I call the “Full” mapping strategy, as outlined in Figure 9.3.
Figure 9.3 – With each operation requiring its own model, the web adapter and application layer each map their model into the model expected by the operation they want to execute
This mapping strategy introduces a separate input and output model per operation. Instead of using the domain model to communicate across layer boundaries, we use a model specific to each operation, such as SendMoneyCommand, which acts as an input model to the SendMoneyUseCase port in the figure. We can call those models “commands,” “requests,” or similar.
The web layer is responsible for mapping its input into the command object of the application layer. Such a command makes the interface to the application layer very explicit, with little room for interpretation. Each use case has its own...