Search⌘ K

Different Input Models for Different Use Cases

Explore the importance of using dedicated input models for different use cases in Hexagonal Architecture. Understand how separating input models avoids code smells, improves input validation, and prevents side effects while keeping business logic clean.

Same input model

We might be tempted to use the same input model for different use cases. Let’s consider the use cases “Register Account” and “Update Account Details”. Both will initially need almost the same input, namely some account details like a description of the account.

The difference is that the “Update Account Details” use case also needs the ID of the account to be able to ...