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

2
  • Asked already. Watch the answer Mar 25, 2017 at 3: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, 2017 at 3:13

2 Answers 2

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.

0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.