Search⌘ K
AI Features

What About Read-Only Use Cases?

Explore how to implement read-only use cases in Hexagonal Architecture by using query services to separate data retrieval from commands. Understand the importance of distinguishing queries for better code clarity and alignment with design principles like CQS and CQRS.

We'll cover the following...

Previously, we have discussed how we might implement a use case that modifies the state of our model. How do we go about implementing read-only cases?

Implementing read-only case

Let’s assume the UIUser Interface needs to display the balance of an account. Do we create a specific use case implementation for this?

It’s awkward to talk of use cases for read-only ...