Could somebody explain high overview concept of Aggregates and Events based on practical example.

Hi.
Could I ask to somebody explain a concept of Aggregates and Aggregate roots. I just partly understand how should i operate with them in context of CQRS/Event-Sourcing.

There is this quote in http://cqrs.nu/Faq

DDD-Batch-Aggregate-Quote.png

And i have a some prototype like this:

DDD-Example-Q.png

If I am right, then in context of some Postal Service - Advertisement Services (bounded context), that whole thing named in violet NEW_PROJEKTS… is a Aggregate Root? Right? It’s a single project multiple people operate with. It has a stages and it contains a huge amount of child aggregates, like zones (highlighted yellow), groups for zone grouping (red) and optionally could contain a special selection of special addresses (extra service in those) in some zones (green). As well there are bunch of actions for every aggregate in this picture (hidden under context menus).

So, if I want to make bulk action (to add some distribution rules) on subset of all assigned zones (districts), that i naturally are thinking of Sagas, but in quote above they state that probably i have wrong aggregate boundaries.

Could somebody be so kind and explain me based on this example, what is what?

  1. Aggregate Root
  2. Aggregate
  3. Entity
  4. What data should be saved in event?
    If i want to persist single small change (users collaboratively adding zones (districts) to project via web sockets), should i save a whole state of whole aggregate root? It sounds like a just crazy idea as there will no be a factory to produce storage for me. :slight_smile:

WBR,

Dzintars

The terms Aggregate and Aggregate root are defined by the Domain Driven Design language. The bible of DDD is Eric Evans “Big Blue Book”, Domain Driven Design: Tackling Complexity in the Heart of Software.

https://www.amazon.co.uk/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215

Personally I preferred Implementing Domain Driven Design by Vaughn Vernon.

https://www.amazon.co.uk/Implementing-Domain-Driven-Design-Vaughn-Vernon/dp/0321834577

If you don’t want to study the full subject you can probably find what you’re looking for in this pdf:

http://domainlanguage.com/ddd/reference/

Hope that helps.

Laurence

Thank You for reply.
I hoped to get some explanation based on concrete example.

I know those books and i know how to Google. :slight_smile:
I’m in middle of Evans book and Vaughn is next in the list.

I responded privately with links to more in depth explanations…

However:

Could somebody be so kind and explain me based on this example, what is what?

  1. Aggregate Root
  2. Aggregate
  3. Entity
  4. What data should be saved in event?

We cant really answer these with the information given. Anything that we would say would be guessing. You literally have not even mentioned what the use cases of the system are. Aggregate boundaries are heavily dependent on the use cases involved!


Virus-free. www.avast.com

DDD-Batch-Aggregate-Quote.png

DDD-Example-Q.png

This book is highly recommended: https://www.amazon.com/gp/product/B07C5WSR9B/ref=ppx_yo_dt_b_d_asin_title_o00?ie=UTF8&psc=1
It will guide you to Event Sourcing with Event Store.

A hard, but enjoyable journey!