0

an UML class diagram that pictures an high school administration system is required.

  • Pupils and Teachers derive from Person
  • each Pupil belongs to 1 (School)Class
  • each class has btw 10-25 students
  • each Teacher has >= 1 Certificate to teach a (School)Subject

[Draft of Elements]

further, it is asked to design the following:

a) which Teacher, teaches which Class, in which Subject, for how many hours/week?
b) is there a safe way to assure that a Teacher only teaches Subjects he has a Certificate for?

after fuzzing around several hours i came up with this: [Complete Draft].

but i still can not imagine how to design the diagram in a way that all (or at least three) of the conditions from a) are presented as required.

is there actually a way to do so in a UML class diagram?

edit: after reading Ayo Ks comment i came up with this: img

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
tingtong
  • 67
  • 2
  • 8

2 Answers2

1

which Teacher, teaches which Class, in which Subject, for how many hours/week?

This means that what binds the teacher to a class is a Subject. Since there are multiple subjects, a teacher will have a property that represents a list of subject, and a class will also have a list of subjects. For representing how many hours/week, this will be tied to the subject. A subject should have a property representing how many hours it should last and a property representing how many times a week it is taught. This way once a teacher teaches a subject, by getting the subject the teacher takes, you can pick out how many times a week and how may hours

b) is there a safe way to assure that a Teacher only teaches Subjects he has a Certificate for?

For this since a certification is tied to a subject, things will change a bit. This will mean that a Teacher will no longer have a List of subjects as a property but rather a list of certifications, so by getting the certifications a teacher has, you can get the subject(s) the teacher can take from the certifications and the number of hours/week the teacher takes the subject

Hope this helps you in finishing your diagram.

Ayo K
  • 1,719
  • 2
  • 22
  • 34
1

I would use an association class with a constraint.

enter image description here

granier
  • 1,739
  • 13
  • 25
  • thanks! but, is this a standard UML class diagram annotation? this way it seems very logic to me. i would love to write it like that. just, is this an 'official' solution? – tingtong Nov 10 '17 at 18:14
  • This is _official_ notation. The constraint is OCL. Can't say much about it (not fluent in that), but it looks ok. – qwerty_so Nov 10 '17 at 19:47
  • @tingtong OCL is a language to define constraints, it is not part of UML but it used to defined constraints on model. OCL is defined by OMG as UML. – granier Nov 10 '17 at 22:41
  • @granier which program did u use for that diagram? thanks – tingtong Nov 11 '17 at 13:38
  • @tingtong EA but association class is part of UML and should be available in all tools ... – granier Nov 11 '17 at 20:22