Re: Can an Entity be Shared across many Aggregates?

David Hounslow <[email protected]>
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <[email protected]>
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.


------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/domaindrivendesign/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/domaindrivendesign/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo Groups is subject to:
    http://info.yahoo.com/legal/us/yahoo/utos/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.