Monday, 25 July 2011

Command Query Responsibility Segregation (CQRS)

We've begun working on a new project at Esendex, one that involves making use of (amongst other things) the fashionable CQRS pattern. I've been asked to head up the project and over the past week I've read a number of articles and looked at some example projects. So far, I like what I'm seeing; an architecture for developing scalable, extensible and maintainable applications. It looks promising and if proven successful could be an approach we adopt at Esendex to pre-empt any future scalability problems that could result from our continued growth.

What is CQRS?

CQRS is an evolution of command-query separation by Bertrand Meyer. It works using Domain Driven Design where the behaviour sits in the domain objects; utilising DDD means the language used is important.

As the name suggests, the CQRS pattern separates out the objects for commands (for changing application state) and objects for queries (that expose the application state). This is quite a contrast to the more typical CRUD patterns that most developers (including me!) are comfortable with. Systems typically written as one, are split into a read side and a write side.

High level CQRS diagram ('borrowed' from another blog)


Expect follow up posts soon, in the mean time, here's some useful links:

No comments:

Post a Comment