3

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

Community
  • 1
  • 1
Peter Tao
  • 1,668
  • 6
  • 18
  • 29
  • Asked already. [Watch the answer](http://stackoverflow.com/questions/27459257/how-to-represent-an-attributes-data-type-as-an-array-of-objects-on-class-diagra) – Adir Ratzon Mar 25 '17 at 03:08
  • Thank you for commenting Adir. I have seen that post previously, but I am wondering about the UML design. I would like to know if LectureTime should be a separate class. – Peter Tao Mar 25 '17 at 03:13

2 Answers2

3

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.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
0

If LectureTime is an Entity then yes. I guess it is, because of the relation you've added.

Adir Ratzon
  • 181
  • 3
  • 8