A Algorithms and Computational Biology Lab

| Home | CV | Publications | Teaching | Library | Personal | Links

The Liskov Substitution Principle

Illustration of the gap between engineers and scientists

The Liskov Substitution Principle (LSP) can be paraphrased as:
Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.
Barbara Liskov first wrote it as follows [1]:
What is wanted here is something like the following substitution property: If for each object o1 of type S there is an object o2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when o1 is substituted for o2 then S is a subtype of T.
References: Barbara Liskov, "Data Abstraction and Hierarchy," SIGPLAN Notices, 23,5 (May, 1988).