Home > database >  UML Multiplicity: "0..*" vs "*"
UML Multiplicity: "0..*" vs "*"

Time:11-23

Is there any difference between 0..* and * for representing multiplicity in UML Class Diagrams? I cannot find a comprehensive guide online for multiplicity notations. To me they both seem to be saying the same thing conceptually.

CodePudding user response:

While Dave's answer is correct, I'd like to add for the records that it's not just a question of personal opinions. The UML specifications are explicit about this notational shortcut:

UML 2.5.1, p.35: If the lower bound is equal to the upper bound, then an alternate notation is to use a string containing just the upper bound. For example, “1” is semantically equivalent to “1..1” multiplicity. A multiplicity with zero as the lower bound and an unspecified upper bound may use the alternative notation containing a single star “ * ” instead of “0..*” multiplicity.

CodePudding user response:

There's not any difference, or at least I've never heard of anyone using them differently.

To me, 0..* is more explicit in the sense that it says explicitly that 0 is an expected case. In another case you may write 1..* to show that 0 is not allowed.

In general, I would just pick one style and stick with it for consistency.

  • Related