Hints and Tips
When you model relationships in the UML,
- Use dependencies only when the relationship you are modeling is not structural.
- Use generalization only when you have an "is-a-kind-of" relationship; multiple inheritance can often be replaced with aggregation.
- Beware of introducing cyclical generalization relationships.
- Keep your generalization relationships generally balanced; inheritance lattices should not be too deep (more than five levels or so should be questioned) nor too wide (instead, look for the possibility of intermediate abstract classes).
- Use associations primarily where there are structural relationships among objects. Do not use them to show transient relationships such as parameters or local variables of procedures.
When you draw a relationship in the UML,
- Use either rectilinear or oblique lines consistently. Rectilinear lines give a visual cue that emphasizes the connections among related things all pointing to one common thing. Oblique lines are often more space-efficient in complex diagrams. Using both kinds of lines in one diagram is useful for drawing attention to different groups of relationships.
- Avoid lines that cross unless absolutely necessary.
- Show only those relationships that are necessary to understand a particular grouping of things. Superfluous relationships (especially redundant associations) should be avoided.