S SDDO Notes · IE BCSAI 2025
03 · Foundations

Design Patterns

A pattern is a named solution to a recurring design problem. Useful as a vocabulary; dangerous as a shopping list. Apply only when the cost of not applying is concrete.

Why patterns exist

Software has shapes that repeat: "I need to create an object whose concrete class is decided at runtime", "I need to apply an operation across a tree", "I need a single shared resource". Naming these shapes lets two engineers say a word and skip thirty minutes of whiteboarding.

Creational

Structural

Behavioural

How to actually apply them

The wrong question: "where can I apply Decorator?" The right question: "this method has a chain of orthogonal behaviours bolted on with flags — is Decorator the cleanest fix?" Patterns earn their place by removing duplication or coupling. If introducing the pattern adds files without removing duplication, the pattern is the wrong tool.

Code smells (Topic 4) tell you when a pattern is missing. Patterns tell you what to try. Don't drive from the patterns — drive from the smell.

What to remember at exam time

Source · Slides
Design Patterns — slides
Open PDF