SteelReed

Search

Search posts, questions…

OOP & DesignQuestion 9 / 42

Junior

What is SOLID and why does it matter in day-to-day work?

Short answer

SOLID is five principles that make code easy to change: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion. The shared goal: lower coupling, higher cohesion.

SOLIDLow couplingHigh cohesionOne business changetouches few placesEasy to test, cheap tochange

3 points to say:

  1. Five principles: one reason to change, extend without editing old code, subclasses replace parents, small client-shaped interfaces, depend on abstractions.
  2. Goal: low coupling, high cohesion; with Spring, DIP, SRP and OCP come fairly naturally through DI.
  3. They are heuristics, not laws; apply them where there is real pressure to change.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.