Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regarding 0 to 1 and 1 to 0 associations in UML

Just want to know how can we differentiate the multiplicities 0..* and 1..*.

For example:

 ---------             ---------
|         |0..*   0..*|         |
|CLASS    |-----------| STUDENT |
|         |           |         |
 ---------             ---------

For this, if we put 1..* in class object, I can see that both represent the same behaviour. Is that right?

0..* ---> Zero or more classes can have zero or more students, which means a class or more classes can have more students or no students. (excluded no class behaviour)

1..* ---> One or more classes can have zero or more students, which means a class or more classes can have more students or no students.

Please correct my understanding?

like image 688
PrabaharanKathiresan Avatar asked Dec 29 '15 07:12

PrabaharanKathiresan


People also ask

What is the meaning of 0 and 1 in class diagram?

Numerals are used at either end (or both ends) of the association relationship to convey multiplicity of each class. In the above notation, the numeral "1" means "exactly one". The "0..1" notation is used to denote "zero or one".

What is association in UML with example?

An association class is identical to other classes and can contain operations, attributes, as well as other associations. For example, a class called Student represents a student and has an association with a class called Course, which represents an educational course. The Student class can enroll in a course.

What does 0 * mean in multiplicity?

Exactly one object. This is the default multiplicity of an association according to UML. 0..* No object or at least one.


1 Answers

You have to read it the other way around.

If you have 1..* on the Class end that means that a Student has at least 1 and possible more Classes.

0..* on the Class end means that a student could also have no Classes at all.

like image 51
Geert Bellekens Avatar answered Oct 04 '22 17:10

Geert Bellekens