What is a design pattern?
Options
- A ready-made library that you install and import
- A named, proven solution to a common design problem (Correct option)
- A color theme used in user interfaces
- A type of database for storing code samples
Answer
A proven, named solution to a common design problem that you adapt to your code
Why
Design patterns are reusable ideas, not code you download. Examples: Factory, Strategy, Observer, Adapter.
They give teams a shared vocabulary: saying 'use a Strategy here' explains a whole design in two words.
Use them when they solve a real problem, not to show off.
Remember
Pattern = named, reusable solution idea.