Commands vs queries
Separate methods that change state from methods that only ask: command-query separation keeps side effects obvious.
Commands vs queries is a Low-Level Design lesson in SwadhyAI Notes, under API, Persistence & Data Modeling.
Related lessons
- Designing a class API
- Commands vs queries
- Evolving an API without breaking callers
- Collection API design
- Null, Optional, empty collections
- Request/response vs domain objects
- Errors and domain exceptions
- Validation at the boundary
- DTO vs domain model
- Idempotency in object APIs
- Keeping persistence out of the domain
- Repository abstraction
- Where transactions begin and end
- Domain model vs persistence model