jargon

Design patterns·Modelling the domain

outside code holds a reference to the order and never to a line item, so every change goes through the order.

Aggregate root

Also calledroot entity, aggregate root entity

The single entity that acts as the entry point to an aggregate: external references point only at it, and it is responsible for the invariants across everything inside. That rule is what makes the boundary real rather than a drawing — if anything can reach an inner object directly, nothing is enforcing the aggregate's rules. Repositories are defined per aggregate root for the same reason.

Commonly confused with