DenkzeitWiki

Suchen:

Aktuelle Änderungen Printable View Änderungen Bearbeiten

LiskovSubstitutionPrincipleClear Trail
Main /

Liskov Substitution Principle

BarbaraLiskov

DesignByContract

DifferenceBetweenTypeAndClass

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.


That is, subclassing is a software construction principle, used to create a new class which has similar behavior to another class, while a subtype is a class which can be substituted for another class and still be guaranteed to behave properly, albeit differently.


...satisfy all contextual expectations. It can do more, but it can never break the expectations of the context, or else the context must be modified.


LSP as stated above seems to be about replacing one concrete type with another, and the conditions under which a concrete subtype can be used in every context that another type was used. DBC is less restrictive because you pick and choose what you want to be invariant. LSP is tight, and it points towards things like blackbox reuse.

Edit - BackLinks - Tags - Page Hist - Print - Changes - Home - Orphans - Help

Zuletzt geändert am 10.12.2007 19:29 Uhr und seit 7. April 2005 952 aufgerufen.