Patterns for Software Design and Architectures
Patterns are named solutions for recurring design problems, such as strategy, observer, decorator, factory and repository, and testing is how you check that a design is really flexible. Code that is hard to test usually has hidden dependencies that the right pattern would expose and invert.
Stage: Design Principles · Part of the Software Design and Architecture roadmap · Last reviewed 19 November 2026
What to learn in Patterns
- Replace a branching conditional with the strategy pattern
- Add behaviour dynamically with a decorator
- Use dependency injection to pass collaborators into a class
- Write a unit test using a fake or mock for a dependency
- Hide persistence behind a repository interface
- Recognise when a pattern adds complexity without benefit
Patterns interview questions
What is dependency injection and why does it help testing?
Dependency injection supplies a class's collaborators from outside instead of creating them inside. In tests you can pass a fake database or clock, so the unit is isolated and deterministic, and production wiring can swap implementations.
How does the decorator pattern differ from inheritance?
A decorator wraps an object that implements the same interface and adds behaviour at runtime, and decorators can be stacked in different combinations. Inheritance fixes the extra behaviour at compile time and can cause a large class hierarchy.
Where Patterns fits in the Software Design and Architecture roadmap
Patterns belongs to the Design Principles stage (intermediate level), which takes about 30 hours. Write maintainable code.
Other units in this stage
Back to the full Software Design and Architecture roadmap