• 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

class relationships

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose a class A has a 'has a' relationship with class B that can only be traversed from A to B.
In the class diagram this is shown as an arrow from A to B.
But, do I also have to show one of the following for class A:
- a property of type B (thus using the class name of B as the type)
- a property that represents the id of the related B instance (long, String)
If so, when would I use a class property and when an id property?
 
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Drawing UML diagrams is the work of artists. Different artists do it different ways. You will have some goal to motivate you to draw a class diagram. E.G. you think some class has too many responsibilities and refactoring it into two classes reduces coupling to the part of it that ... blah, blah, blah
AFAIK the arrow symbol represents a reference.
If you draw an arrow to Integer most of the time this is too fine grained.
If you draw your new class as an attribute of some class then you have deprived the rest of us on the team any idea what its attributes and operations are.
If a class is an attribute of another class, a composition relationship, then the black diamond can come into play.
UML diagrams are to communicate concepts to others. We can't read your mind and don't bore us.
If you are using a tool for engineering/reverse engineering code you'll have to follow its conventions.
HTH
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic