Command–query separation

It was devised by Bertrand Meyer as part of his pioneering work on the Eiffel programming language.

[1] More formally, methods should return a value only if they are referentially transparent and hence possess no side effects.

CQS is beneficial to DbC because any value-returning method (any query) can be called by any assertion without fear of modifying program state.

In practical terms, CQS allows all assertion checks to be bypassed in a working system to improve its performance without inadvertently modifying its behaviour.

[citation needed] Command query responsibility segregation (CQRS) generalises CQS to services, at the architectures level: it applies the CQS principle by using separate Query and Command interfaces and usually data models to retrieve and modify data, respectively.