Liskov substitution principle
In
object-oriented programming, the Liskov substitution principle is a particular definition of
subtype that was introduced by
Barbara Liskov and
Jeannette Wing in a 1993 paper entitled Family Values: A Behavioral Notion of Subtyping .The principle was formulated succinctly as follows:Let be a property provable about objects of type . Then should be true for objects of type where is a subtype of .Thus, Liskov and Wing's notion of "subtype" is based on the notion of
substitutability; that is, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program (e.g.,
correctness).
See more at Wikipedia.org...
Liskov substitution principle
<
programming,
theory> (LSP) The principle that
object-oriented functions that use
pointers or references to a
base class must be able to use
objects of a
derived class without knowing it.
Barbara Liskov first wrote it as follows: 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 behaviour of P is unchanged when o1 is substituted for o2 then S is a
subtype of T.
A function that violates the LSP uses a reference to a base class and must know about all the derivatives of that base class. Such a function violates the
open/closed principle because it must be modified whenever a new derivative of the base class is created.
[Liskov, B. Data Abstraction and Hierarchy, SIGPLAN Notices. 23(5), May 1988].
(2001-09-14)
(c) Copyright 1993 by Denis Howe