liveBook · Manning

Aggregate root

An aggregate root is the designated domain object through which an aggregate’s members and consistency rules are accessed and modified.

How 3 Manning books explain it

Spring in Action, Sixth Edition

The designated domain object that serves as the entry point for access to the objects within an aggregate.

How it is used
Organizes taco-order persistence around TacoOrder as the entry point for its Taco objects.
How deep it goes
Explains the boundary through JDBC save steps and MongoDB mapping, while identifying R2DBC repository behavior that needs a service-level workaround.
Examples
Uses a TacoOrder containing tacos, separate Ingredient objects, an OrderRepository interface, and a MongoDB document class.
What you can do after
Build it from scratch: define a JDBC repository that saves an order with its tacos and ingredient references.

Read how Spring in Action, Sixth Edition explains aggregate root →

Simple Object-Oriented Design: Create clean, maintainable applications

An aggregate root is the designated domain object through which an aggregate's members and consistency rules are accessed and modified.

How it is used
Uses aggregate roots to control updates to complex object graphs and keep domain invariants consistent.
How deep it goes
Defines access and repository rules, then works through enrollment and cancellation updates while deferring deeper aggregate design.
Examples
Uses Basket with Items and Products, then Offering with Enrollment, available spots, enrollment, and cancellation.
What you can do after
Apply it by routing aggregate changes and persistence through a root while evaluating when smaller aggregates or eventual consistency fit.

Read how Simple Object-Oriented Design: Create clean, maintainable applications explains aggregate root →

Collaborative Software Design: How to facilitate domain modeling decisions

An aggregate root is the designated domain object through which modifications to an aggregate are managed.

How it is used
Uses aggregate roots to preserve business invariants while translating collaborative models into executable code.
How deep it goes
Explains consistency boundaries, transactions, invariants, and a simplified implementation, while stopping short of a complete production design.
Examples
Demonstrates ScheduledMovieSeating for seat allocation and ScheduledMovie for ticket capacity and request-size constraints.
What you can do after
Apply it by grouping related domain objects and routing invariant-sensitive modifications through one aggregate root.

Read how Collaborative Software Design: How to facilitate domain modeling decisions explains aggregate root →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.