Search⌘ K

Different Output Models for Different Use Cases

Explore how to create output models tailored to each use case, returning only necessary data to minimize coupling and maintain cleaner software design. Understand why keeping outputs specific helps apply the Single Responsibility Principle and avoids overloading domain entities.

Returning data

Once the use case has done its work, what should it return to the caller?

Similar to the input, it has benefits if the output is as specific to the use case as possible. The output should only include the data that is really needed for the caller to work.

In the code example of the “Send Money” use case above, we return a boolean. This is the ...