Domain-Driven Design (50 Qs)•Part 3: Advanced Architecture & Production Patterns (Senior / Lead)
What is CQRS (Command Query Responsibility Segregation) in DDD?
senior LevelSystem Design
In Simple Words: Splits the application into two independent models:
- Write Side (Commands): Uses Tactical DDD. Loads full Aggregates, validates invariants, and commits state transitions.
- Read Side (Queries): Bypasses domain aggregates and repositories completely! Queries read-optimized projections or materialized views directly using lightweight DTOs.
- Allows scaling read performance independently (e.g. 100,000 queries/sec on read replicas) without burdening transactional write aggregates.