Sharing models between use cases
In Chapter 5, Implementing a Use Case, I argued that different use cases should have different input and output models, meaning that the types of the input parameters and the types of the return values should be different.
Figure 11.1 shows an example where two use cases share the same input model:
Figure 11.1 – Sharing the input or output model between use cases leads to coupling between the use cases
The effect of sharing in this case is that SendMoneyUseCase and RevokeActivityUseCase are coupled to each other. If we change something within the shared SendMoneyCommand class, both use cases are affected. They share a reason to change in terms of the Single Responsibility Principle (which should be named the “Single Reason to Change Principle,” as discussed in Chapter 3, Inverting Dependencies). The same is true if both use cases share the same output model.
Sharing input and output models between...