views:

26

answers:

2

I have a Client object which will either have a Person object or Organization object in it. These Person objects or Organization objects might have relations to other objects independent of the Client object. In this case should I use a General Aggregation association between Client -> Person and Client -> Organization where the Client object is the whole.

Also note these scenarios:

  1. Person might be a normal Person in some scenarios like; Person makes payment on behalf of Client(*Organization*)
  2. Person might be a Client which bought a Product from Us.
  3. Person might be a Supplier
+1  A: 

don´t forget an xor constraint between both associations (since a client cannot be connected to both a person and a organization)

Jordi Cabot
Do you know how to do it in BOUML.
andho
And are you agreeing that I should use a General Aggregation?
andho
There is not enough information to see if this should be an aggregation or a normal association but the semantics is almost the same so it´s not that important
Jordi Cabot
+1  A: 

While you really didn't provide enough information, it sounds like you're describing a typical Role Class Model.

I suspect that your Client doesn't really have a Person or an Organization, but rather that Person or an Organization is a Client, or IOW, either a Person or an Organization can play a role of a Client in a certain relationship.

There are various ways to model this, and no single correct solution. You might find this article helpful

Daniel Maurić
The Client object will have more (client)information apart from the data that the Person or Organization class would have.
andho
I have checked the article you provided and I prefer no. 4 (Role Class Generalization) but as PHP does not support Multiple Inheritance I will try no. 3 (Role Class Association) which is what I suggested but it is using a normal association.
andho
You gave a good reference so I'm gonna accept your answer
andho