Search code examples
umlclass-diagramuse-caseuse-case-diagrammultiplicity

Should I use n or * if I have exact number of things in the model?


I need to create UML diagrams for homework about a game ( called Downfall). I have to create it so that it works on any number (n) of player.

If this is an exact number that appears in multiple places of the diagram, should I use n or *? I would use it in multiplicity parameters and in size of array.

For example: There are n sides, and if there is a dial on a side, there has to be dial on each side at that position, so the dial has n-1 connected dials.


Solution

  • According to the UML specification, n is syntactically a valid multiplicity (see Ister's answer), but to make sure it is also semantically correct, you would have to define the meaning of n somewhere. Usually, n is not used as a multiplicity in UML diagrams.

    I would advise you to use * in this case. If the minimum number of players is 2, you may use 2..*.

    Additionally, you may use notes or constraints, e.g. { the number of connected dials is equal to the number of sides minus one }. You may also use a formal constraint language, like OCL.