Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M1254

Liskov Substitution Principle

Liskov Substitution Principle
SystemsHigh supportSystems Theory
Included
account_tree

Updated 2026-07-30

Loading revision record…

Summary

The Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called strong behavioral subtyping, that was initially introduced by Barbara Liskov in a 1987 conference keynote address titled Data abstraction and hierarchy. It is based on the concept of "substitutability"…

Definition

Subclasses must be able to replace their base classes without causing errors in the program. That is, subclasses must not change the behavioral contract of the base class. Scaffold use: Maintain contract consistency. If you promise a service (base class), your upgraded version (subclass) must be fully compatible with the old functionality, and must not secretly reduce or change behavior, otherwise it will break user trust (system crash).

How to use

Maintain contract consistency. If you promise a service (base class), your upgraded version (subclass) must be fully compatible with the old functionality, and must not secretly reduce or change behavior, otherwise it will break user trust (system crash).

Mechanism

The Liskov substitution principle requires that subclasses (subtypes) can seamlessly replace their base classes without breaking program correctness, meaning the behavioral contract must be compatible with the base class.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • If a square overrides setting width to also set height, it breaks the substitutability of a rectangle, violating LSP.

Common pitfalls

  • Mistaking 'can inherit' for 'should inherit'. LSP focuses on behavioral substitutability, not syntactic feasibility.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Liskov_substitution_principleZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS