The big idea: The classes are already in the description — they are the things it keeps talking about.
The attributes are what it says about them. The methods are what it says they do.
The nouns-and-verbs method: Underline the nouns: candidates for classes and attributes.
Underline the verbs: candidates for methods.
Crude, and it gets a first draft right surprisingly often.
Free preview
This is the free notes preview
You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:
- FlashcardsLock in vocabulary and key terms with spaced repetition.
- Practice questionsAnswer exam-style questions and get instant AI marking.
- Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
- Personalised study planA daily plan built around your exam date and weak areas.
The UML box and what each part means. Step to 'The class' first.
Interactive diagram
Explore the labelled diagram, charts and maps for this topic in full study mode.
The three parts
- Name at the top
- Attributes in the middle: name and type
- Methods at the bottom, with their return type
- Always in that order
Visibility
- - private — reachable only inside the class
- + public — reachable from outside
- Attributes are normally private
- Methods are normally public
Relationships
- A plain line joins classes that know about each other
- A hollow triangle points at the class being inherited from
- Numbers on the line show how many, as in an ERD
Asked to construct a UML diagram? Draw the three parts in this order: name, attributes, methods.
Asked to draw how two classes relate? Two boxes, one line, then label it with what links them and how many.
Underlined means static: A UML entry drawn underlined belongs to the class itself rather than to each object.
A count of how many objects have been created is written underlined, because there is only ever one of it.
Practice with exam-style questions
Answer exam-style questions and get AI feedback that shows you exactly what examiners want to see in a full-marks response.
One class, one responsibility
A class should be about one kind of thing. If you describe it and need the word "and", it is probably two classes.
A Book that also sends emails is doing two jobs, and both become harder to change.
Methods that belong to the data
A method belongs in the class that holds the data it uses.
borrow() belongs on Book, because Book holds onLoan. Putting it elsewhere would force onLoan to be public, which loses encapsulation.
Inherit only for a genuine "is a"
Ebook is a Book, so inheritance fits. A Library is not a Book, however many it holds — it has books.
Inheriting where the relationship is really "has" produces designs nobody can follow.
Attributes private, methods public
Start that way every time, and open something up only when there is a reason.
It is far easier to make a private attribute public later than to take back one everything already depends on.
Why design before coding: A class diagram is quick to draw and quick to change. Rewriting a class other classes already depend on is neither.
That is the argument the guide is making when it says UML aids effective design and planning.
How this is tested — you must identify sensible classes and put each method with the data it uses. It comes up two ways:
Paper 2 — working with code
- Construct a class design or UML diagram, 4-6 marks
- Identify classes and methods from a description
- Explain a design decision
Paper 2 — the algorithmic-thinking question
- Design from a description with no code required
- Say why one arrangement is better than another
The classic trap: Using inheritance where the relationship is really has a. A Library has Books; it is not a Book. Ask "is a" out loud before drawing the triangle.
A cinema books seats for screenings. Each screening shows one film in one room at a time, and customers book seats. Construct a class design.
Model answer plan
See the answer broken into clear points, with guidance on how each point earns marks.