According to Wikipedia, the expression “egg of Columbus” refers to a brilliant idea that seems so simple and obvious after the fact. The same idea that at some point seems doable by everybody was out of reach before someone actually did it.
CQRS is the latest egg of Columbus in software architecture. Once smart people like Bertrand Meyer, Martin Fowler, Greg Young, Udi Dahan had formalized it at different times and through different steps, it sounds like it is such an easy thing that nobody needs credits for that. As I see things, one of the reasons why CQRS doesn’t sound so exoteric as DDD is that it is really simple and effective to the point that is seems to be a natural element of software development.
CQRS in a way fights the idea that it is always necessary build a complex and convoluted domain model that encompasses all possible actions within a given domain. CQRS applies an old strategy that rulers of the past used extensively: Divide-et-Impera. It does that by splitting commands from queries and inviting architects to design both through distinct stacks. Stacks are distinct in all regards–technology as well as patterns.
This year, I’ll have a full-day precon workshop at Microsoft TechEd Europe in Barcelona (Monday, October 27) just dedicated to .NET architecture. The title is “Architecting .NET Solutions for the Enterprise” and it lays the ground for a CQRS-inspired design and implementation starting from a deeper analysis of DDD. You’ll see a reference application–an online store–first designed and implemented as a canonical DDD project. Next, you’ll see the same application rebuilt using commands, events and queries as distinct stacks. Here’s the list of modules:
- Discovering the Domain Architecture: ubiquitous language and context mapping.
- The Domain Model Supporting Architecture: essentials of the Domain Model pattern and role and structure of the domain layer in a multi-layer architecture.
- The CQRS Supporting Architecture: task-based implementation in the command stack and plain LINQ-to-Entities queries in the query stack.
- Event Sourcing: storage of events instead of working out a full-fledged domain model and persisting it through an O/RM.
- UX-First Design: the key message of this workshop is that today the UX is the most important aspect of any software. Focusing on UX leads to understanding clearly and unambiguously the tasks the application must perform.
Most of the content of the workshop is inspired by the freshly released 2nd edition of the NAA4E book “Microsoft .NET: Architecting Applications for the Enterprise” (Microsoft Press, 2014) that I authored hands down with Andrea Saltarello. To stay in touch, have a look at our Facebook page.
PS: By the way, we’ll be releasing the reference applications in the book (and discussed in the workshop) on Codeplex sometime soon!