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?
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