top of page

What are Aggregates in Event Storming?

In Event Storming, "Aggregate" is a key concept that comes from Domain-Driven Design (DDD), and it's used to represent a cluster of related domain objects that should be treated as a single unit when making changes. Here's a breakdown of how the concept of an aggregate fits into Event Storming:


What is Event Storming?

Event Storming is a collaborative, workshop-based approach used to quickly explore and model complex business domains. It involves mapping out domain events (things that happen in the system) in a visual and narrative way. Key components of Event Storming include:

- Events: Actions or occurrences in the system (e.g., "Order Placed").

- Commands: Instructions to the system (e.g., "Place Order").

- Aggregates: The structure that handles these commands and events.


Role of an Aggregate in Event Storming

An Aggregate is essentially a grouping of entities and value objects that are closely related and have strong business rules. Aggregates ensure consistency by enforcing business rules and managing changes within their boundaries. 


1. Command Handling: Aggregates are responsible for handling commands. When you see a command in an Event Storming session, it usually implies that the aggregate will handle it.

   - Example: The `Place Order` command would be handled by an `Order` aggregate.


2. Event Generation: When a command is processed successfully, the aggregate generates domain events that represent what happened as a result of the command.

   - Example: If the `Place Order` command is handled by the `Order` aggregate, it might generate an `OrderPlaced` event.


3. Boundaries: Aggregates define transaction boundaries. This means that all changes within an aggregate must be consistent before the aggregate can be considered complete. Aggregates are key for maintaining data integrity in complex systems.


4. Consistency and Encapsulation: An aggregate enforces consistency rules between the entities and value objects it contains. Changes to the state of the aggregate must go through it, ensuring that no inconsistent or partial updates are made.


Example in Event Storming

- Suppose you're modeling a shopping cart system using Event Storming:

   - Events: "Item Added to Cart," "Cart Checked Out."

   - Commands: "Add Item to Cart," "Checkout Cart."

   - The Aggregate here could be the "Shopping Cart," which handles the commands (e.g., `AddItemToCart`) and generates events like `ItemAddedToCart`.


In Event Storming, once the team identifies related commands and events, they start recognizing which parts of the system are aggregates, allowing for a better-organized domain model.


Why Aggregates Are Important in Event Storming

- Clarity: They help identify key parts of the domain that manage complex logic and maintain consistency.

- Simplifies Complexity: By grouping related entities and value objects into an aggregate, you reduce the complexity of the domain.

- Ensures Business Rules: Aggregates enforce domain rules within their boundaries, which is critical in Event Storming for capturing the correct system behavior.


To summarize, in Event Storming, aggregates represent logical groupings of domain entities that process commands and generate events while enforcing business rules. They are essential for maintaining consistency and modeling the behavior of complex systems.

bottom of page