SOLID Principles
ELI5 — The Vibe Check
SOLID is five principles that keep object-oriented code from turning into spaghetti: Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion. They're the ten commandments of OOP, except there are only five.
Real Talk
Five design principles for object-oriented programming introduced by Robert C. Martin: (S) Single Responsibility - one reason to change, (O) Open-Closed - open for extension, closed for modification, (L) Liskov Substitution - subtypes must be substitutable, (I) Interface Segregation - small, focused interfaces, (D) Dependency Inversion - depend on abstractions.
When You'll Hear This
"This class violates Single Responsibility — it handles both validation AND database access." / "SOLID principles help, but don't apply them dogmatically — sometimes a pragmatic violation is fine."
Related Terms
Clean Architecture
Clean Architecture is like an onion with strict rules: the inner layers (your core business logic) have absolutely no idea the outer layers (databases, API...
Dependency Injection
Instead of your UserService creating its own DatabaseConnection (tight coupling), you pass the database in from outside: new UserService(db).
Design Pattern
Design patterns are like recipe cards for solving common coding problems.
OOP (OOP)
OOP is a way of organising code by modelling the world as objects — things that have properties (what they are) and methods (what they do).