CQS & CQRS

CQS means “Command-query separation”. It was introduced by Bertrand Meyer as part of his work on the Eiffel programming language. A method is either a command performing an action, or a query that returns data, but not both. Being purely action-performing methods, commands always have a void return type. Queries, on the other hand, should not have any observable side effect on the system itself.

Originally, CQRS was called “CQS”, too. But it was determined that the two are different enough for CQRS to have its own name. The main distinguishing feature is this:

  • CQS puts commands and queries in different methods within a type.
  • CQRS puts commands and queries on different objects.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.