The big idea: A design pattern is a named, reusable solution to a problem that keeps coming up — not a library, and not code you copy.
Its real value is vocabulary: "use an observer here" replaces a paragraph of explanation.
What a pattern is and is not
- Is a description of a structure and why it works
- Is shared vocabulary between developers
- Is not a library or a framework — you implement it yourself
- Is not obligatory: forcing a pattern where there is no problem adds complexity for nothing
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.
Singleton
Factory
Observer
Strategy
Each one removes a specific pain: Factory removes scattered constructor calls. Observer removes the subject having to know its listeners. Strategy removes an if-chain choosing an algorithm. Singleton removes duplicate instances — at the cost of introducing global state.
Name the pain, and the pattern justifies itself.
Stop wasting time on topics you know
Our AI identifies your weak areas and focuses your study time where it matters. No more overstudying easy topics.
| Problem | Pattern | What it removes |
|---|---|---|
| One instance must be shared | Singleton | Duplicate, inconsistent instances |
| Which class to create varies | Factory | Concrete class names scattered everywhere |
| Many parts react to a change | Observer | The subject knowing its listeners |
| The algorithm must vary | Strategy | An if-chain selecting behaviour |
Over-application is a real fault: A pattern applied where its problem does not exist adds indirection, files and vocabulary for no benefit.
A factory producing one kind of object is just a constructor with extra steps. In an exam, saying when not to use a pattern shows judgement.
How this is tested — you must match a pattern to the problem it solves and say what it removes. It comes up two ways:
Paper 2 — working with code
- Explain a named pattern, 3-4 marks
- State the purpose of singleton, factory or observer
- Identify which pattern a description matches
Paper 2 — the algorithmic-thinking question
- Choose a pattern for a scenario and justify it
- Explain a drawback of a pattern
The classic trap: Describing what the pattern is without saying what it removes. "An observer notifies subscribers" is a definition; "so the subject never has to know who is listening, and new listeners need no change to it" is the answer.
The problem Observer answers, and the shape it uses.
Interactive diagram
Explore the labelled diagram, charts and maps for this topic in full study mode.
A dashboard shows a temperature reading as a number, a graph and a warning light, all updating when a new reading arrives. Suggest a design pattern, justify it, and state one drawback.
Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.