Vol. I a living index of named laws · est. mmxxvi no ads · no account
The Law Tomeindex of named laws

Is The Liskov Substitution Principle real?

rated Heuristic

It is a rule of thumb, not a finding. It is useful and widely relied on, but it was never established by measurement and does not claim to be. The Liskov Substitution Principle is rated Heuristic in this index. Its name is occasionally printed in English books, among the 903 whose print frequency can be measured, so this is a question people are actually asking.

The Liskov Substitution Principle says: An object of a superclass must be replaceable by an object of any subclass without breaking the program. 3 sources sit behind the Heuristic rating, 2 of them primary. Below: how far that goes in the entry's own words, and how it compares with the 1,116 entries around it.

Occasionally printed in printed books, of 903 measured names. The others in this band
33 of 69 entries in software & systems rest on something other than measurement, 48% of the field
45% of all 1,116 entries in the index are rated the same way. The best-known are the least likely to rest on measurement

Heuristic a dependable rule of thumb, not a proven theorem

Where it runs out

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.

What people get wrong about 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.

What the claim rests on

  1. Liskov, B. & Wing, J. (1994). "A Behavioral Notion of Subtyping." ACM Transactions on Programming Languages and Systems 16(6). — the formal statement of the substitution property. primary
  2. Martin, R. C. (1996). "The Liskov Substitution Principle." Engineering Notebook, C++ Report. — the naming and the practitioner formulation. primary
  3. "Liskov substitution principle." Wikipedia — the 1987 keynote, the Liskov–Wing formalisation, and the behavioural conditions on subtypes. secondary

Read the full entry on The Liskov Substitution Principle

About this verdict

So is The Liskov Substitution Principle real or not?

It is a rule of thumb, not a finding. It is useful and widely relied on, but it was never established by measurement and does not claim to be. This index does not rule on truth; it records what kind of support a claim has. Heuristic means a dependable rule of thumb, not a proven theorem. The four ratings in full.

Who decides the rating?

We do, and that is the softest part of this whole index. It is stated on the page that makes the argument rather than buried. The rating is applied against a published scale, the entry's own limits are quoted rather than summarised, and every source is linked so you can disagree with us from the same evidence.

Where is the rest of it?

The full entry has what the idea says, where it came from, how it works, worked examples and what it is often confused with. This page is only the evidence question. Every entry rated the same way is on the Heuristic list.