This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi I have a question about the association of classes in class diagram. For example, I have classes called Customer and Order. Order does not have a reference of its Customer, it only stores the CustomerID of its Customer. I think it is not correct to show the association between these two classes in the implementation class diagram. Am I right? Thank you Leo
You could also invent your own stereotype for the association, indicating that it is done by an id instead of a reference (<<by id>> ) . You could even use a custom icon for this, which might be more communicative (a square with "id" inscribed, for example; used similar to the aggregation and composition icons). Remember, the goal of UML is communication. It isn't tabooed to be creative! [ October 11, 2002: Message edited by: Ilja Preuss ]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
If all (or most) object-object relationships in your system are done using such IDs then it's an association, plain and simple. The value in showing such an association in a UML diagram is that it helps a reader understand the relationships between objects. In many cases tha actual mechanism (id, reference, pointer, URL, XPath, whatever ...) by which one object refers to another is of lesser importance.
Thank you very much! All the answers are very helpful for me. Leo
Joined: Jul 13, 2001
Franck said: The value in showing such an association in a UML diagram is that it helps a reader understand the relationships between objects
Sure! But the notations used have to be shared or explained somewhere. I recently worked with somebody which had a stereotype for human and non-human (which had a black strip on the eye ) actors. Even if it did affect the bulk understanding of the diagram, I couldn't help asking myself why some actors had this black strip.... W. [ October 11, 2002: Message edited by: Wilfried LAURENT ]