Diagram Desk

School class roster class diagram

A school composes classes, a class aggregates students: classes cannot exist without the school, students can move.

The diagram

School+name StringClassroom+grade int+section intStudent+name String+transfer(classroom) voidHomeroomTeacher+subject Stringleads
Class diagram · 10 shapes

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

ShapeSymbolConnections
SchoolClassholds +name String · → Classroom
ClassroomClassholds +grade int, +section int · → Student · ← School, HomeroomTeacher
StudentClassholds +name String, +transfer(classroom) void · ← Classroom
HomeroomTeacherClassholds +subject String · → Classroom(leads)

Symbols used here

SymbolMeaning
ClassA box with name, attributes and methods.
CompositionFilled diamond at the whole; parts die with it.
AggregationHollow diamond at the whole; parts can live alone.
AssociationOne class knows and uses another; solid arrow.

All class diagram symbols and how to draw

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

More class diagram examples

All SeewolLabs tools