Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a more complex aggregate with more than one entity #24

Open
Heucles opened this issue Aug 6, 2017 · 1 comment
Open

Comments

@Heucles
Copy link

Heucles commented Aug 6, 2017

Can you put together a sample of what it would look like an aggregate with more than one entity, something like:

  • Car (root)

    • Wheel
    • Tire
    • Engine (root of its own aggregate)
  • Customer (root)

    • Car (root of its own aggregate)
    • Address

I am having some trouble setting this up, since Customer events can have an effect over the Car aggregate. Can you point me into the right direction?

@adrai
Copy link
Contributor

adrai commented Aug 7, 2017

Hi @Heucles!

An aggregate:

  • handles commands and emit events
  • ensures the validity of invariants
  • is the transactional boundary
  • runs business processes
  • makes decisions
  • focus on verbs (doing) => intention

I would recommend not to start with the entities, start with the intention.
Which commands should be sent to the same aggregate to ensures the validity of invariants?

Little hint: Try first to not give your aggregate a name. (first catch intention, then give a name)

If you want, you can even try to do an event storming (by @ziobrando) => https://techbeacon.com/introduction-event-storming-easy-way-achieve-domain-driven-design ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants