• Stars
    star
    191
  • Rank 202,877 (Top 4 %)
  • Language
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Aggregates by example

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 name Description Language Persistence method
Availability / Resource Reserving resource based on its availability and other policies PHP not available
Loan / Loan Application Accepting loan application based on attachment verifications PHP not available
Cart / Shopping Basket Shopping cart with free items Java in 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