Just yesterday, I had this question again. And Iāve always hated this question - because I never had a good answer that fit into just a few sentences.
Iād start with something like: āWell⦠thereās this Object, and it contains a cluster of other objects, some of which are Entitiesā¦ā Thatās usually when people stop listening and start thinking: āWhat is this guy even talking about? Just get to the point!ā
So why is this so hard to explain?
Because weāre using the wrong term. Naming matters.
The term Aggregate comes from Domain-Driven Design, first introduced by Eric Evans in his classic Blue Book. But the definition often confuses people. If you donāt read carefully, it leads you in the wrong direction.
The key idea behind Aggregates isnāt about objects. Itās about consistency. In fact, you donāt need any objects at all to apply the concept.
Let me explain.
A simple use case
Let“s assume, we have a customer registration, we need to implement. The final missing piece of functionality before the big launch.
Now, we see the āCustomerā can have a list of addresses. But there are some rules to it - for example a customer must only ever have at most two addresses assigned. How do we enforce this?
First, letĀ“s define the rule using a simple āGiven / When / Thenā Scenario.
Letās take a simple scenario: weāre trying to register a new customer (me!) - with three addresses. But the system shouldnāt allow that. So now comes the tempting step: define a Customer Aggregate.
And thatās where things start to get weird.
Is it really the Customer weāre talking about here?
Customer is a broad concept - and its meaning shifts depending on the use case. Is it an existing customer or a prospect? Someone registering, or just browsing the catalog? Are they blocked? Have they already ordered and are now complaining?
There are so many possible states and roles a customer can be in.
So does the rule āa customer may only have two addressesā really belong to the Customer - or to the Registration Use Case?
This is exactly where object thinking starts to lead us astray. And yet - thatās what most people default to when they hear the word Aggregate.
But what if we defined Aggregates differently?
Personally, I rarely use the term Aggregate anymore. In fact, I once made someone buy me a drink just for saying Aggregate in one of my presentations - despite me warning everyone up front! ( true story! )
One term I do like using is Consistency Boundary. Itās a much better label - even if it confuses people at first.
But I have a better one.
āAn Aggregate is just a set of rules for a certain use caseā
Thatās better. And much easier to understand.
Doesnāt it immediately feel strange to call this set of rules āCustomerā?
We donāt even know what use case weāre dealing with. Is it Registration? Ordering? Customer Management? What rules are we actually talking about?
Itās clearly about Registration - so a better name would be Customer Registration.
Better, right?
And now you can combine that with what I wrote in my book āUnderstanding Eventsourcingā
It even feels strange to use āa set of rulesā as Data Holder, doesnĀ“t it?
Aggregateless Event-Sourcing
And now that we finally understand what an Aggregate really is - just a set of rules for a specific use case - suddenly everyone starts talking about Aggregateless Event Sourcing.
The good news is - with our new understanding, conceptually nothing changes!
Even with Aggregateless Event Sourcing, we still have tons and tons of rules for specific use cases. We just donāt bundle them into one big Customer object anymore.
Cheers,
Martin
Next steps
If your Team wants to explore, if Event Modeling is the right way - I want to take a look at one of your use-cases in a short 45 Minute Session with your Team - at no cost. I want to learn about your way of working and see, if I could help? ( Just comment SESSION, and I“ll send you some information )
There is a 120min-Recording of my last webinar āFrom idea, to Model, to Prototype, to Codeā if you want to get a clear picture of how that works in practice.
Find it here: https://youtu.be/6DqaNKxjvko
Join the Agentic Engineer Program
Apply Spec-Driven Development Hands-On - Event Modeling, Event Sourcing, and AI Engineering with autonomous agents.
Book a Call Today
Want to talk through how Event Modeling could work for your team or project? Letās have a quick, no-pressure conversation.
