3
votes

Is there any drawbacks when a concept is modeled in a bounded context as a root entity and in another bounded context as a child entity (same identity in both BC's)?

From Eric Evans DDD:

ENTITIES other than the root have local identity, but it only needs to be unique within the aggregate, since no outside object can ever see it out of the context of the root ENTITY.

The concept would have global identity even when it plays the role of child entity. I think Evan's point is to avoid modification of the child entity outside its aggregate, but in another BC no invariants would be violated. What do you think?

3

3 Answers

3
votes

Using a global id here is perfectly fine. I think Eric meant that the id should be unique at least within its parent aggregate.

I have a lot of similar cases in the systems we work on, and that's the exact way we've designed it.

0
votes

The drawbacks, as I see it, are the leaking of concepts between Bounded Contexts when sharing Entities.

At first it may seem like a good idea in terms of preventing duplication however you will pay for it later. I can see a scenario where changes in one context make sense but not in the other.

0
votes

This is fine; the 'child entity' is an immutable value object in the context of the 'root entity'. In other words, the root entity may reference child entities, but it cannot alter their attributes.