4 ms·
Unfortunately, the Wikipedia article [1] doesn't distinguish between CQRS (command-query responsibility segregation) and CQS (command-query separation). They ar
by sampsonetics 11y ago
Unfortunately, the Wikipedia article [1] doesn't distinguish between CQRS (command-query responsibility segregation) and CQS (command-query separation). They are entirely different concepts. Compare Fowler's CQRS article [2] to his CQS article [3].
CQS is an old OO design principle suggesting that an object's behavior is easier to reason about if every method either changes the state of the object or interrogates its current state. That's not always possible, but it's a helpful habit.
CQRS is the idea that use cases involving searching and reporting across many entities are fundamentally different from use cases involving interactions with particular entities. It is therefore sometimes worthwhile to develop separate data models for searching and reporting that are updated asynchronously.
[1] https://en.wikipedia.org/wiki/Command–query_separation https://en.wikipedia.org/wiki/Command–query_separation
[2] http://martinfowler.com/bliki/CQRS.html http://martinfowler.com/bliki/CQRS.html
[3] http://martinfowler.com/bliki/CommandQuerySeparation.html http://martinfowler.com/bliki/CommandQuerySeparation.html