Command-query separation (source code)

= Command-query separation

Command-query separation distinguishes commands that change state from queries that return observations without changing that state. It permits repeated inspection without further updates, but clients may need a protocol connecting updates and subsequent observations. Combining a command and its resulting observation into one <object method> can be convenient for transformation <object interfaces>. Neither organization alone guarantees thread safety.