What is the importance of association multiplicity in class diagrams? Why and when should we indicate them? Thanks.
+1
A:
They convey the business rules more directly. E.g an house contains one or more rooms.
fastcodejava
2010-05-19 06:55:21
+1
A:
UML gets used in many ways. There are a huge number of things a class diagram could show. If you're trying to exhaustively document a system's design then you may need to show them all. If you're trying to explain a more specific aspect of the design, only show it if it's relevant (i.e. has a bearing on how that aspect would be designed/implemented).
pdbartlett
2010-05-19 07:36:56
+1
A:
They allow the designer a quick visual way of communication that would be difficult without multiplicities. You would have to use notes or other space-eating annotations in the diagram.
In a UML diagram I want to have multiplicities for all other associations other than one-on-one.
Why?
- One-on-one is the visual cue you get from a simple association. It's sort of the default.
- Multiplicities contain domain knowledge (car->wheel is usually a 1 -> 4 association. The association without the multiplicity looks like a car has one wheel.
- A designer can "deserialize" the things he thinks are granted because everybody in the domain probably knows them, but the developer probably does not know!
Thorsten79
2010-05-19 07:43:39