170 likes | 298 Views
Command and Query Responsibility Segregation. Cameron Fletcher. Agenda. What is CQRS? A look at a system that uses CQRS What have we just seen? Why would anybody ever do this?. What is CQRS?. Command and Query Responsibility Segregation.
E N D
Command and Query Responsibility Segregation Cameron Fletcher
Agenda • What is CQRS? • A look at a system that uses CQRS • What have we just seen? • Why would anybody ever do this?
Command and Query Responsibility Segregation CQRS is simply the creation of two objects where there was previously only one. The separation occurs based upon whether the methods are a command or a query.
Denormalizer Application Fully Consistent Data Store Eventually Consistent Data Store Command Service Query Service Client
Architecture • Domain • Application • Fully Consistent Write Model • Denormalizer • Eventually Consistent Read Model • Command and Query Services • Task Based User Interface
Advantages • Performance and Scalability • Separation of Concerns • Reduced Complexity of Domain • Ability to Parallelize Development • Highly Decoupled • Increased Testability • Easier to Adapt to Change
Disadvantages • Increased Complexity of Architecture • Learning Curve for Developers • Fear of Change
When Not To Use CQRS(In This Way) • Lack of Requirements • No Domain to Work With • If the Benefit isn’t Worth It • When it’s not Useful • On a System as a Whole • Not Just for Scalability • Legacy Systems