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.