Last Updated on Feb 16, 2021

The Command-Query Responsibility Segregation (CQRS) pattern applies the CQS principle by using separate Query and Command objects to retrieve and modify data, respectively. It is based on the observation that an application's consumption side can be developed and managed entirely separately from the manipulation side.

Most of the effort in building complex applications is spent on validating external changes and ensuring all business invariants remain satisfied after the change. This is the focus of architectural concepts like Domain-driven Design (DDD), which attempt to model application code as closely as possible to the Business Domain. DDD concentrates exclusively on modeling domain concepts in code and encapsulating complexity to ultimately validate whether a change is permitted.

The data consumption side is only about optimally organizing data for consumption and authorization to ensure only users with appropriate permissions can access appropriate data. This opens up exciting opportunities in modeling how data is persisted - Data can essentially be stored in any format, without thinking about the what and the how of applications that will consume the data later. For example, information can be stored as raw events with the Event Sourcing pattern, accurately representing changes in the external world.

© 2022 Ambitious Systems. All Rights Reserved.