4

I have a two entity objects Site and Customer where there is a many to many relationship. I have read you try not to model this in DDD as it is in the data model and go for a unidirectional flow.

If I wanted to show this in UML, would I show it as it is in the data model:

Site * ----->*Customer but the direction arrow gives the flow?

or as following

Site ----->*Customer But then this would imply that Customer can only go in one site.

3
  • "I have read you try not to model this in DDD"? Can you provide the quote or the link?
    – S.Lott
    Dec 18, 2011 at 22:35
  • Is this the same question? stackoverflow.com/questions/4909384/…
    – S.Lott
    Dec 18, 2011 at 22:38
  • @S.Lott "I have read you try not to model this in DDD" => as far as I remember, towards the first third of the DDD book, Evans explains that bidirectional associations (either many-to-many or one-to-many) are cumbersome and he gives examples of how to turn them into one-directional associations. Namely, a Site's Customers collection must be kept in sync with all the Site collections of the Customers which might be hard to achieve. Sep 3, 2012 at 13:39

1 Answer 1

2

The sense I get from this article is that within the realm of DDD, Site--->*Customer does not indicate that a Customer cannot be related to more than one site. Rather, it simply indicates that a Site can have multiple Customers (as in a list of them) whereas, the Customer treats each Site as a unique interaction and does not maintain a list of Sites.

This makes some sense. The Site is a Site, whether or not anyone visits it. The Customer, on the other hand, only becomes a Customer upon visiting a Site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.