Back to Topic 7.2 — OOP: multiple classes
7.2.5Computer Science HL5 flashcards

Design patterns

Practice Flashcards

Flip to reveal answers
Card 1 of 57.2.5
7.2.5
Question

What is a design pattern?

Click to reveal answer

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.

Card 1definition

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.

Card 2definition

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.

Card 3definition

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.

Card 4definition

Question

What is the strategy pattern?

Answer

Interchangeable algorithms behind one interface, **selected at run time** — replacing an if-chain that chooses behaviour.

Card 5concept

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.

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