Design patterns are reusable, proven solutions to common software design problems — general templates for how to structure code to solve recurring challenges. They provide shared vocabulary and tested approaches, helping write better, more maintainable code.
What design patterns are
DESIGN PATTERNS = proven, reusable solutions to RECURRING design problems:
→ not code to copy, but TEMPLATES/approaches for structuring code
→ distilled from experience (best practices for common situations)
→ e.g. "how do I ensure only one instance of a class?" → Singleton pattern
→ describe the PROBLEM, the SOLUTION structure, and the trade-offs
The classic categories (Gang of Four)
CREATIONAL → how OBJECTS are created (Singleton, Factory, Builder, Prototype)
STRUCTURAL → how objects/classes are COMPOSED (Adapter, Decorator, Facade, Proxy, Composite)
BEHAVIORAL → how objects INTERACT/communicate (Observer, Strategy, Command, Iterator, State)
→ the famous "GoF" (Gang of Four) patterns; many others exist too
