README.md

April 15, 2020 ยท View on GitHub

Logo

Aggregate definition

What is an aggregate?

Cluster the entities and value objects into aggregates and define boundaries around each. Choose one entity to be the root of each aggregate, and allow external objects to hold references to the root only (references to internal members passed out for use within a single operation only). Define properties and invariants for the aggregate as a whole and give enforcement responsibility to the root or some designated framework mechanism.

  • Eric Evans, Domain-Driven Design Reference: Definitions and Pattern Summaries

List of examples

This repository contains following examples:

Example nameDescriptionLanguagePersistence method
Availability / ResourceReserving resource based on its availability and other policiesPHPnot available
Loan / Loan ApplicationAccepting loan application based on attachment verificationsPHPnot available
Cart / Shopping BasketShopping cart with free itemsJavain memory hashmap

Info

Presented implementations are just examples to show some concepts. There is almost always more than one valid solution for given requirements.

Aggregates designing rules

4 rules about designing aggregates by Eric Evans:

  • Model true invariants in consistency boundaries
  • Design small aggregates
  • Reference other aggregates by identity
  • Use Eventual Consistency outside the boundary

Aggregate Design Canvas

Coming soon...

Authors