SOLID & Design Patterns Interview Question #15
What is a design pattern?
SOLID Principles, Design Fundamentals, Repository, Factory, Strategy & Decorator Junior Beginner
Quick Interview Answer
A design pattern is a reusable, named solution structure for a recurring software design problem. A pattern describes roles, relationships, intent, and tradeoffs rather than providing one fixed piece of code.
Detailed Explanation
A design pattern is a reusable, named solution structure for a recurring software design problem. A pattern describes roles, relationships, intent, and tradeoffs rather than providing one fixed piece of code.
Patterns create a shared vocabulary among developers. They should be selected because they solve an actual design problem, not because using more patterns automatically makes software better.
Code Example
// Examples of common patterns:
Repository
Factory
Strategy
Decorator
Mediator
Observer
Adapter
Builder