New C# based CQRS Tutorial available
A new CQRS, Command Query Responsibility Separation, Starter Kit to help developers get up and running with CQRS on .NET has been developed and made available as open source by Jonathan Worthington and Carl Mäsak.
The two developers notes that this is not a framework, it’s a “bunch of C# code” meant as a tutorial for developers interested in learning about CQRS, and as a possible starting ground for a CQRS based system, in which case you will change the code to fit your needs.
The tutorial code is an application in the cafe domain focusing on the concept of a tab which tracks the visit of an individual or group to the cafe. The tutorial itself is divided into five steps starting with design, domain logic and read models followed by integration into an ASP.NET MVC web application.
In the tutorial, Jonathan and Carl also bring up a few points to consider, e.g. regarding transactions and eventual consistency, if you want to extend the example to a production system.
Jonathan and Carl emphasizes that unless you are in a learning phase, you shouldn’t start with CQRS because it’s the new modern thing, instead you should arrive at this decision because of your architecture goal:
I want to work in terms of commands/events for my domain logic, because modelling and writing tests this way will help me deliver a system that meets the customer's needs. I want to persist using an event store, but that doesn't meet my querying needs. Therefore, I need to also have a relational database. This means my reads and writes need to happen through different code paths, which means I will be doing CQRS.
CQRS & Event Sourcing are two closely related architectural approaches to DDD and they are the hottest topics in DDD of the last couple of years.
Martin Thompson Jul 27, 2014