Card 01/ 07
How the Five SOLID Principles Work Together
Open/closed is the goal, dependency inversion the means, and Liskov keeps it safe.
The five SOLID principles are not five separate checklists; each one makes the others possible or safe. This card explains how they connect, so you can apply them as one design rather than five rules.
The open/closed principle states the goal: add behaviour by adding code, not by editing code that works. On its own it does not say how. The other four supply the means and the safety.
Read the diagram from the bottom up. Single responsibility finds the seams: a class with one reason to change has an obvious place where a variation can be cut out. Dependency inversion turns that seam into an extension point: the policy names an interface, and new behaviour arrives as a new implementation. Interface segregation keeps that interface small, so a new implementation does not have to fake methods it cannot support. Liskov substitution makes the result safe: a new implementation must keep the interface's promises, or the code that was closed to modification breaks anyway.
The relationships also explain why fixing one principle often fixes another. Splitting a class for single responsibility removes a reason for it to be edited, which is an open/closed improvement. Removing a forced method for interface segregation removes a method that would have broken substitution.
They also explain the failures. An interface added for open/closed but implemented by a class that raises on half its methods breaks Liskov, and the extension point becomes a trap. An inverted dependency on a ten-method interface makes every fake expensive, so nobody writes one. When one principle is applied and another ignored, the gain from the first usually leaks away through the second.
← → move through sections and cards