What is the difference between SOLID principles and design patterns?
Answer
SOLID principles are high-level guidelines for software design — they describe what properties good code should have (single responsibility, extensibility, substitutability, etc.) without prescribing specific implementation approaches. Design patterns are concrete, reusable solutions to commonly occurring design problems — they are implementation blueprints (e.g., Factory, Observer, Strategy). The two are complementary: design patterns are often the mechanism for achieving SOLID. For instance, the Strategy pattern helps implement OCP, the Decorator pattern helps implement OCP and SRP, and the Dependency Injection pattern implements DIP. SOLID tells you what to aim for; design patterns give you how to get there.
Previous
How does OCP promote extensibility?
Next
What is tight coupling and how does it relate to SOLID?