Comparison
Liskov substitution principlevsSOLID
Liskov substitution principle
the subclass threw on a method the parent promised, and every caller written against the parent was suddenly wrong.
The rule that an instance of a subtype must be usable anywhere the supertype is, without the caller having to know. Violations are easy to spot once you know the shape: a subclass that strengthens a precondition, weakens a guarantee, or throws where the parent returned. The square-and-rectangle example is the standard illustration, but the version you meet in real code is a read-only collection that inherits from a mutable one.
Full entry →SOLID
someone rejected the pull request citing a five-letter acronym, and only two of the five letters were actually about the problem.
Five object-design principles collected under one acronym: single responsibility, open–closed, Liskov substitution, interface segregation and dependency inversion. Taken individually they are useful heuristics with genuine failure modes to point at; taken as a checklist they are the most reliable way to talk a team into more indirection than it needs. Being able to name all five and say honestly which ones you find load-bearing is a better interview answer than reciting them.
Full entry →