Ever since attending Greg Young's Unshackle Your Domain talk at QCon '08 in San Francisco and a later two-day training course given by Greg Young I've wanted to build a sample application that made use of the principles of Command-Query Responsibility Separation (CQRS).
But every few months we have a one day internal training course at Xebia Software Development and after Sjors Grijpink and I proposed to give a training on DDD and CQRS we got some time to actually prepare and implement a CQRS example application.
The application is fairly simple (as it should be for a one day training course) but touches on all the major components needed for a full-blown CQRS implementation.
The source code for the training exercises can be found at github. There are three branches:
- exercise - the code used for doing the training exercises.
- solution - the same code as above but with the solutions added.
- master - the main development branch, currently used to implement more advanced features like snapshotters, command-event conflict resolution, historical tracing, etc.
The Xebia ITR CQRS presentation is also available.
All-in-all the training was a success and I think that the basic CQRS principles are the way forward when you need to build enterprise applications with a complicated domain logic or strong auditing or historical tracing requirements.