Chapter 10 - The Aggregate is dead
continues from Chapter 9 - An event is just a fact, pure
The aggregate is finally dead, together with its negative aspects.
This new approach, which focuses on the decision block, has several benefits:
- Perfect match with storytelling
- Focus on behavior instead of model
- Less contention
- Less complexity
- Simpler to refactor
But be careful: this does not mean having to organize the system in order to have hundreds of completely unrelated command handlers. Absolutely not!
Clustering commands into logical groups and delegating their execution to the same model is and remains a correct programming approach.
The difference lies in the fact that before, by the very definition of aggregate, these models necessarily had to be isolated from each other. Killing the aggregate means admitting the possibility of contamination between these models without renouncing consistency.
A less dogmatic approach, which in any case must not disregard good programming practices, but which, thanks to greater flexibility, allows the best design to emerge over time.
The ability to create these intersections between models doesn't necessarily have to be exploited in every situation. There will be thousands of cases where this is not necessary!
As always, there is no single answer or single truth. Choices must always be made with pragmatism and common sense. No pattern can replace thinking.
Watch the full story on youtube