Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the importance of association multiplicity in class diagrams?

What is the importance of association multiplicity in class diagrams? Why and when should we indicate them? Thanks.

like image 583
Ristovak Avatar asked May 19 '10 06:05

Ristovak


2 Answers

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!
like image 166
Thorsten79 Avatar answered Dec 28 '22 08:12

Thorsten79


They convey the business rules more directly. E.g an house contains one or more rooms.

like image 37
fastcodejava Avatar answered Dec 28 '22 08:12

fastcodejava