0:00
/
0:00

Aggregate is one of the most stimulating terms in the programming world. Some people are treating it as the Holy Graal of business logic design.

When planning to design a new one, we roll up our sleeves and feel like king Arthur and his knights going on a great search. Still, too often, we end up lost on Avalon island without knowing what to do and what we need to achieve.

Aggregate doesn't have to be that hard, as it's only a pattern to guard our consistency. Like a business transaction. Yet, we might not even need it or use it differently to get focus on invariants and removing it on the fluffiness.

That’s what I tried to show in this webinar!

I invited a special Guest: ChatGPT. We asked it for inspiration about the example:

Could you give me a real-world example of the complex DDD aggregate?

Describe the business rules and invariants. It should have at least seven properties, several business rules and invariants showing business logic.

It should have a list of nested data and one entity.

Root aggregate should represent a complex workflow or process. It should express lifetime or state transition and have several methods for running business logic.

Use some random, uncommon, business use case fitting the above requirement (other than Order to not get us bored).

Describe aggregate flow, business rules first and invariants before implementation.

Don't list or describe properties; just express them in code. Provide an example implementation using C# 11.

Start with the main aggregate implementation, then put the rest of the entities' definitions.

Write the whole code, including business logic and invariant checks. Provide aggregate and entities as separate code snippets.

Remember that entities should also be broken into dedicated snippets.

And it came up with an intriguing Chemical Reaction sample.

Watch the whole webinar to see how the initially bloated aggregate was made more explicit and focused on the business flow.
See how we make unwanted scenarios impossible and how eventually, we came into an event-driven world and explained the Decider pattern.

Provide the feedback afterwards!

See also the source codes with the state after the webinar in my sample repo.

Interested? Read also more on this topic in my articles:

Cheers!
Oskar

Webinars: