Comparison
AggregatevsAggregate root
Aggregate
you can change these five objects together in one transaction, and anything outside them has to wait its turn.
A cluster of objects treated as one unit for changes, with a boundary that defines what must be consistent immediately. It is the pattern that decides transaction scope and lock scope, so it is a performance and concurrency decision as much as a modelling one. Making aggregates too large is the standard mistake, and it shows up as contention rather than as anything a modeller would notice.
Full entry →Aggregate root
outside code holds a reference to the order and never to a line item, so every change goes through the order.
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.
Full entry →