It is difficult to guarantee the consistency of changes to objects in a model with complex associations. Invariants need to be maintained that apply to closely related groups of objects, not just discrete objects. Yet cautious locking schemes cause multiple users to interfere pointlessly with each other and make a system unusable.


Cluster the entities and value objects into aggregates and define boundaries around each. Choose one entities to be the root of each aggregates, and control all access to the objects inside the boundary through the root. Allow external objects to hold references to the root only. Transient references to internal members can be passed out for use within a single operation only. Because the root controls access, it cannot be blindsided by changes to the internals. This arrangement makes it practical to enforce all invariants for objects in the aggregates and for the aggregates as a whole in any state change.

(Note: Many such schemes are possible. This section of the book describes one particular set of rules in detail.)