Principles
In the beginning, Test Doubles became popular as an instrument for isolating tests from third-party libraries. Despite that being one of its use cases, and still very useful, it is not the only one and perhaps not the most important.
To attain good object-oriented design, the Test Doubles technique leverages Test-Driven Development by guiding the composition of a coherent, well-encapsulated system of types within a code base. By focusing on behavior instead of data, Test Doubles leads developers to think about object interactions early, identifying the public interfaces first. This focal point switch in the way tests are created is crucial in finding optimal object compositions.
Command-Query Separation
Command-Query Separation or CQS is a principle that states that a software interface abstraction is designed with two types of methods. One method type is known as a Command method, and the other method type is known as a Query method:
Note
Vaughn Vernon, Really...