Architectural Patterns - bradyclifford/sdlc GitHub Wiki
CQRS
Command Query Responsibility Segregation Pattern
The concept of getting away from CRUD architecture applications. Separating out the reads from the write operations. Not only helps with performance and scalability, but also decoupling. By separating out the business logic into commands (writes) and de-normalizing data for reads, you only have to define your business logic in one place, the commands.
Goes really well with DDD, an event bus and event sourcing patterns
This article changed my perspective when I was first introduced to CQRS many years ago.
CQRS vs Specification Pattern
- CQRS is about splitting reads and writes into separate models.
- Specification pattern is about reusing bits of domain logic in reads and writes.
- CQRS represents the overarching principle of loose coupling.
- Specification pattern represents the overarching principle of DRY (Don’t Repeat Yourself, avoidance of domain knowledge duplication).
- Loose coupling trumps DRY in the vast majority of cases, except the simplest ones.