Practice Flashcards
Flip to reveal answersWhat is a design pattern?
Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.
All 5 Flashcards — Design patterns
Sign up free to track progress and get spaced-repetition review schedules.
Question
What is a design pattern?
Answer
A **named, reusable solution** to a recurring problem — a description of a structure and why it works, not a library.
Question
What does the observer pattern do?
Answer
Objects **subscribe** to a subject and are notified when it changes. The subject never knows who is listening.
Question
What is the factory pattern for?
Answer
Putting the decision of **which subclass to create** in one place, so concrete class names are not scattered through the code.
Question
What is the strategy pattern?
Answer
Interchangeable algorithms behind one interface, **selected at run time** — replacing an if-chain that chooses behaviour.
Question
Why is singleton criticised?
Answer
It is **global state**: testing becomes hard and the parts of the program that depend on it are hidden.
Read the notes
Full study notes for Design patterns
Topic 7.2 hub
OOP: multiple classes
More from Topic 7.2
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
Track your progress with spaced repetition
Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.
Start Free