Topic B3 is HL only (AHL). A UML (unified modelling language) class diagram is a universally recognised way to plan a class before you code it, and to show how classes relate to each other. This unit covers the three boxes of a class diagram, the notation for modifiers and static members, and the three relationships the book teaches: inheritance (is_a), aggregation (has_a) and composition (part_of).
Slide 1 / 4
The UML class diagram
A UML class diagram is a standard way to identify the modifiers, identifiers and data types of the variables and methods in a class, so any developer can understand the design.
It is drawn as three stacked boxes. The top box holds the name of the class.
The middle box lists the instance variables together with their types, for example exampleVar: String.
The lower box lists the methods and the parameters they expect, for example exampleMutator(int x).
Check you've got it
0/4
1. In a UML class diagram made of three boxes, what does the middle box contain?
2. In UML class diagram notation, what does a minus sign ( - ) in front of a variable or method indicate?
3. A Book and a Chapter are modelled so that a chapter cannot exist without a book and a book cannot exist without at least one chapter. Which relationship is this, and how is it drawn?
4. A Playlist stores Songs, but a song can exist without being in any playlist and a playlist can exist with no songs. Which relationship does this describe?
Free revision content. Multiple-choice answers are marked instantly. Written answers are marked by AI on /free-mark.