Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Association or Not

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, said like that, the answer is no.
But you have to be careful and check your design.
Somewhere Order may depend depend on Customer, for example to get its address. If you have:

then you will have an association with a "local" stereotype (or a dependency relation. It depends which UML guru you are affiliated to ).

W.
[ October 11, 2002: Message edited by: Wilfried LAURENT ]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frank, well said!
 
kyyung6
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much! All the answers are very helpful for me.
Leo
 
Wilfried LAURENT
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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 ]
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic