Search code examples
design-patternsdomain-driven-designdryaggregaterootvalue-objects

DDD - Share or duplicate a value object to be used between two aggregate roots?


If I have a payment value object can it be shared by two different aggregate roots? or should I duplicate it?

Both options feel wrong!


Solution

  • As long as your VO is immutable, you can share it without any issues. However, Evans prohibits sharing mutable VOs and I think you will also agree with that.