The Liskov Substitution Principle
"An object of a superclass must be replaceable by an object of any subclass without breaking the program."
"An object of a superclass must be replaceable by an object of any subclass without breaking the program."
Inheritance is a promise, not a convenience. If code works with a type, it must go on working when handed any subtype of it — otherwise every caller has to know which subtype it really has, and the abstraction has bought nothing.
Rated Heuristic: a dependable rule of thumb, not a proven theorem. The other 224.
Liskov and Wing's formal version states it as a property of provable statements: if φ(x) holds of objects x of type T, then φ(y) must hold of objects y of type S wherever S is a subtype of T. Practically, that constrains a subtype in ways a compiler will not: it may not demand more of its callers than the parent did, may not deliver less than the parent promised, may not throw exceptions the parent did not, and may not break the invariants the parent maintained. A subtype that violates any of these still compiles, because the type system checks signatures and not behaviour, which is why the principle has to be stated at all.
It is the reason 'is-a' is the wrong test for inheritance and 'behaves-as' is the right one, and it supplies the L in the SOLID set that has shaped two decades of object-oriented design teaching. More broadly it is the clearest statement of a general truth about interfaces: a type system checks that the shapes match, and nothing checks that the promises do.
It is a constraint on behavioural subtyping, and behaviour is not fully specified by most codebases: applying it requires knowing what the parent actually promised, which is often nowhere written down. It says nothing about whether an inheritance hierarchy is a good idea in the first place, only about what a hierarchy must satisfy once it exists. The formal version is also stronger than most designs need or can check: Liskov and Wing's condition quantifies over provable properties, and no mainstream language enforces it.
It is not the rule that a subclass must not override anything; overriding is exactly what it governs. Nor is it a claim that Square should never inherit from Rectangle in any design: the violation comes from the mutable setters, and an immutable Rectangle has no such problem. It is also not a compiler feature: nothing in a type system stops you from breaking it.
Real as a rule of thumb, not as a theorem. The Liskov Substitution Principle is rated Heuristic here: dependable enough to plan with, and with no proof behind it.
Rated from three sources. 225 of the 1,116 entries carry this rating. How the scale works.
The best-known laws are the least likely to rest on measurement; the full verdict on The Liskov Substitution Principle.
Introduced by Barbara Liskov in a 1987 conference keynote, "Data Abstraction and Hierarchy", and given a rigorous form by Liskov with Jeannette Wing in "A Behavioral Notion of Subtyping" (ACM Transactions on Programming Languages and Systems, 1994). The name and the practitioner-facing statement come from Robert C. Martin, whose 1996 Engineering Notebook column in the C++ Report put it as: functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it. It later became the L of Martin's SOLID set.
Everything above traces to dl.acm.org, cs.utexas.edu and en.wikipedia.org, three sources in all, two of them the original publications rather than accounts of them. Nothing is written from memory, and the method is written down. Spot an error or a better source? Suggest a fix.