Command Query Responsibility Segregation

{{Short description|Information technology system architecture}}

In information technology, Command Query Responsibility Segregation (CQRS) is a system architecture that extends the idea behind command–query separation (CQS) to the level of services.{{cite web |last=Young |first=Greg |title=CQRS Documents|url=https://cqrs.wordpress.com/wp-content/uploads/2010/11/cqrs_documents.pdf |access-date=2024-10-09}}{{cite web |last=Fowler |first=Martin|authorlink=Martin Fowler (software engineer)|title=CQRS |url=http://martinfowler.com/bliki/CQRS.html |access-date=2011-07-14}} Such a system will have separate interfaces to send queries and to send commands. As in CQS, fulfilling a query request will only retrieve data and will not modify the state of the system (with some exceptions like logging access), while fulfilling a command request will modify the state of the system.

Many systems push the segregation to the data models used by the system. The models used to process queries are usually called read models and the models used to process commands write models.

Although its origin is usually attributed to Greg Young in 2010,{{cite web |last=Young |first=Greg |title=CQRS Documents|url=https://cqrs.wordpress.com/wp-content/uploads/2010/11/cqrs_documents.pdf |access-date=2024-10-09}} everything indicates that the precursor of CQRS was Udi Dahan who in August 2008 published on his blog a training course that aimed to apply CQRS together with SOA {{cite web |last=Dahan |first=Udi |title=Advanced Distributed Systems Design using SOA & DDD|url=https://udidahan.com/training/ |access-date=2024-10-09}} and in more detail in December 2009 in the article Clarified CQRS.{{cite web |last=Dahan |first=Udi |title=Clarified CQRS|url=https://udidahan.com/2009/12/09/clarified-cqrs/ |access-date=2024-10-09}}

References

{{reflist}}