Search code examples
umldiagramclass-diagram

Proper way to put array in UML diagram?


I am new to UML diagrams, so this may be a very ignorant question though I can't find the answer anywhere.

There is a class Classroom that holds an object of lecture times. Should lecture times be its own class or should it be an attribute of Classroom?

Feel free to critique notation.

Edit: I have already seen this post and it has not helped. I would like to know if LectureTime should be a separate class.

Option 1: Option 1

Option 2:

Option 2


Solution

  • You create a new class if it has more than a single attribute and/or additional operations (which are not just a getter/setter). Or of you plan to add them in a later phase.

    In your case lectureTime is obviously a simple type and the 2nd variant is to be preferred, except see above.

    However, instead of the round braces you should use square brackets like validLectureTimes[] or validLectureTimes[0..*] which are equivalent.