In Chapter 5, Implementing the Model, we went through using value objects to protect invalid values from even being used as parameters for entity constructors and methods. This technique allows us to move a lot of checks to value objects, provides nice encapsulation, and enables type safety. Then, when we create a new entity or execute some behavior using entity methods, we need to execute further checks. Since we can be quite sure that all parameters already contain valid individual values, we need to ensure that a given combination of parameters, the current entity state, and the executed behavior are not going to bring the entity to an invalid state.
Protecting the internal state from being invalid and, as a result, bringing the model into an inconsistent state, is one of the most important characteristics of aggregates. Aggregate invariants must be satisfied...