RE: Re: Can an Entity be Shared across many Aggregates?
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
Adding to Dave, Those problems can be unambiguously solved by answering two questions: 1. Does the element have a life-cycle of its own 2. Is element's use meaningful on its own. But answers are contingent on business context: a tire is of no use on its own but can be identified independently, e.g for second use. http://caminao.wordpress.com/how-to-implement-symbolic-representations/patterns/functional-patterns/composition-patterns/ http://caminao.wordpress.com/how-to-implement-symbolic-representations/patterns/functional-patterns/composition-patterns/ http://caminao.wordpress.com/how-to-implement-symbolic-representations/patterns/functional-patterns/connector-patterns/ http://caminao.wordpress.com/how-to-implement-symbolic-representations/patterns/functional-patterns/connector-patterns/ Remy. ---In [email protected], <david_hounslow@...> wrote: I think the example you give of tire and wheel with truck and Car is a different situation to the one you have with account. In the Truck and Car example it >might< be acceptable to re-use the tire and wheel classes as these will be referring to different instances i.e. A tire an wheel are specific instances tied to either a tire or a truck. But note what you are not doing here is referring to a sub part of another aggregate root, i.e. a truck is not referring to a cars tire (or one car is not referring to another's tire for that matter). But in the account example it sounds as if you are wanting to refer to the same account instance in different places. In this case this needs to be an aggregate root in its own right. Whether you should you re-use value objects that represent the account or not is a different issue, but I would caution against it generally you would only want to refer to the account id in another aggregate, and a shipping aggregate root might have a different view of the attributes related to an account to a payment processor for example. Dave.