School class roster class diagram
A school composes classes, a class aggregates students: classes cannot exist without the school, students can move.
The diagram
Reading it step by step
- 'School' (class): 1 attributes, 0 methods.
- 'Classroom' (class): 2 attributes, 0 methods.
- 'Student' (class): 1 attributes, 1 methods.
- 'HomeroomTeacher' (class): 1 attributes, 0 methods.
- 'School' is composed of 'Classroom'.
- 'Classroom' aggregates 'Student'.
- 'HomeroomTeacher' is associated with 'Classroom' (leads).
Shape by shape
| Shape | Symbol | Connections |
|---|---|---|
| School | Class | holds +name String · → Classroom |
| Classroom | Class | holds +grade int, +section int · → Student · ← School, HomeroomTeacher |
| Student | Class | holds +name String, +transfer(classroom) void · ← Classroom |
| HomeroomTeacher | Class | holds +subject String · → Classroom(leads) |
Symbols used here
| Symbol | Meaning |
|---|---|
| Class | A box with name, attributes and methods. |
| Composition | Filled diamond at the whole; parts die with it. |
| Aggregation | Hollow diamond at the whole; parts can live alone. |
| Association | One class knows and uses another; solid arrow. |
Diagram text
Paste this text into the editor to get the same picture, then change the names to fit your own work.
# School class roster class diagram
classDiagram
class School {
+name String
}
class Classroom {
+grade int
+section int
}
class Student {
+name String
+transfer(classroom) void
}
class HomeroomTeacher {
+subject String
}
School *-- Classroom
Classroom o-- Student
HomeroomTeacher --> Classroom : leads