Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • What exactly is the problem? Let's say they are Aggregate Roots. Does that make any difference? Can you elaborate a bit on what exactly does or doesn't work? Commented Dec 3, 2021 at 11:15
  • @RobertBräutigam In one aggregate, there can only be one aggregate root, so that's the problem. If they are all Aggregate Roots, which one would communicate with other Aggregate Root? Commented Dec 3, 2021 at 11:18
  • I imagine there would be a placedOrder.confirm(...) which returns a ConfirmedOrder, or some such. That would be perhaps the extent of "communication". Otherwise I don't really know what you mean. Commented Dec 3, 2021 at 11:22
  • @RobertBräutigam Oh, I see the problem here. I am thinking that the Order is the Aggregate Root, and other classes are just its states. You are thinking that they are all Aggregate Roots in different Aggregates. Ok, so following your thought, if the PlacedOrder and ConfirmedOrder are both Aggregate Roots in separate Aggregates, and the placedOrder.confirm(...) returns a ConfirmedOrder, would it violate the Aggregate Root must reference other Aggregate Root by its ID principle? Commented Dec 3, 2021 at 11:27
  • PlacedOrder doesn't necessarily has to reference ConfirmedOrder at all. It may just create it. Just to be clear, I don't agree with that "ID" rule at all in the first place. We're not a database, we don't work with primary keys and foreign keys. I know it's in the Blue Book, but even Evans has distanced himself a bit from these concrete things a bit over the years. So I don't think it is a "must" for DDD. YMMV Commented Dec 3, 2021 at 11:40