We have many different aggregates that use an address entity. But we also have an address aggregate because we have a global address book as well.

  • Aggregate Company has many Address Entities
  • Aggregate Agency has many Address Entities
  • Aggregate Address

From a DDD perspective each aggregate is of course independent. But our fancy requirement here is, that when a company is using the same address as the agency we need to update the state of the agencies address entity and the state of the address aggregate as well - because they can be the same.

Let me try to phrase it this way: An address should be unique in the system but we also need to be able to record changes to the addresses in our event history.

What is the proper way of updating the state for each aggregate that shares the same address that gets changed?

  • Is there a reason why the address is not a separate aggregate? Commented Aug 14, 2020 at 9:35
  • 1
    1. What is the relationship between a company and an agency? Why would they share an address? There might be an undiscovered concept there. 2. Addresses are typically value objects, they don’t have an identity (the properties of an address define it’s identity). 3. What’s the reason for having lists of addresses? This might be another hidden concept. You don’t have to answer these questions here, I just want to show that in DDD the answer to a problem is often hiding in undiscovered concepts. Talk to the experts to get a better understanding of the domain and create a better model.
    – Rik D
    Commented Aug 14, 2020 at 10:01
  • What does it mean for an address to change? Is it an address change if the government decides to rename a street? Is it an address change if a Company or Agency moves to a different physical location? If yes to both, should they be handled the same? Commented Aug 14, 2020 at 10:39
  • Let me generalize this more, I think we have this problem with other things as well. This is basically a many-to-many association, this can be contacts, contacts can be assinged to different things (Aggregates) in our system. But when we reconstitute the state of the aggregate from it's event history and the contact or address has changed meanwhile, how would we get that state back? But I think I just answered my question by typing it: It's not directly related. If somebody changed the address but its just related and not part of the contact or company then we don't need to worry about it?
    – floriank
    Commented Aug 14, 2020 at 12:06
  • Does this answer your question? softwareengineering.stackexchange.com/questions/401597/…
    – Rik D
    Commented Aug 14, 2020 at 18:17

1 Answer 1


So here is my understanding of your question.

You are using a form of event sourcing

Company A has 2 addreses, One st and Two st.

Company B also has address One st

At some point One st is renamed to Uno st

You want Company A and B to now be at Uno St, but you also want to be able to retrieve the pre change One st versions.

If they are both in the same AR then they can pick up the address event as relevant to their history.

However, If the company AR is separate from Addresses, ie it only stores the address Id, then there is no event in its history relating to the address change.

But part of the point of event sourcing is the ablity to trigger multiple changes with an event.

Here when the address changes the event can also be sent to the company AR, causing all the companies having address of OldId to update to NewId, thus writing it to their histories

Otherwise you would have to query the Address AR when loading Companies and pull in the address events. This is probably the most performant for individual records, but doesnt allow for bulk operations or for the address change event to trigger actions on the company when it occurs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.