Aggregates are Modeled Processes
A Domain Model has different representations:
- The one in Reality - Business processes, domain users, interaction with the external world.
- The one in Mind - An understanding of the model expressed succinctly to be able to capture on paper or verbally.
- The one in Code - A programmatic translation of the model in mind, represented as code and data objects.
- The one in Memory - An instance of code running in a computational environment with a copy of the codebase. These close the loop with Reality.
Business processes are modeled in code as Aggregates.
Each process maps to one or more Aggregates, which work together to serve the business process. All aspects of the business process - data, events, workflows - are enclosed within the Aggregate {{alias: Aggregates are Cohesive Wholescohesively}}. Aggregates are responsible for ensuring that all invariants within them are satisfied.
Aggregates act as State Machines stepping through each part of the business process, representing the current state clearly.
From a business perspective, Aggregates are Blackboxes that encapsulate all business logic within them and are meaningful representations of the domain, while hiding away the details of technical implementation.