Aggregates and boundariesadvanced
An aggregate root is the only door into a cluster of objects, and keeping that door the only one is what makes an invariant like "the total always matches the lines" true by construction rather than by discipline.
An order with lines. Decide what is a root, what is inside it, and what rule belongs to neither — then make it impossible to reach a line without going through the order.
Nothing outside the aggregate can construct or modify an OrderLine.
Published in full, before you start — every point is one of these and there is nothing else.
An aggregate root is the only door into a cluster of objects, and keeping that door the only one is what makes an invariant like "the total always matches the lines" true by construction rather than by discipline.