principles:liskov_substitution_principle
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
principles:liskov_substitution_principle [2021-09-02 18:26] – old revision restored (2021-09-02 10:48) 65.21.179.175 | principles:liskov_substitution_principle [2021-09-02 18:26] – old revision restored (2021-09-02 10:48) 65.21.179.175 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Liskov Substitution Principle ====== | + | ====== Liskov Substitution Principle |
===== Variants and Alternative Names ===== | ===== Variants and Alternative Names ===== | ||
Line 11: | Line 11: | ||
===== Principle Statement ===== | ===== Principle Statement ===== | ||
+ | > " | ||
===== Description ===== | ===== Description ===== | ||
Line 23: | Line 24: | ||
* Only waken preconditions when overriding methods | * Only waken preconditions when overriding methods | ||
* Only strengthen postconditions when overriding methods | * Only strengthen postconditions when overriding methods | ||
+ | * Use Delegation instead of Inheritance | ||
+ | * Figure out better abstractions | ||
+ | |||
+ | ===== Caveats ===== | ||
+ | |||
+ | See section [[#contrary principles]]. | ||
+ | |||
+ | |||
===== Origin ===== | ===== Origin ===== | ||
+ | |||
+ | Barbara Liskov: // | ||
Line 47: | Line 58: | ||
==== Complementary Principles ==== | ==== Complementary Principles ==== | ||
- | | + | * [[Model Principle]] (MP): MP demands inheritance relations to resemble an " |
- | * [[Invariant Avoidance Principle]] FIXME | + | |
- | | + | |
* [[Principle of Separate Understandability]] (PSU): When building inheritance hierarchies, | * [[Principle of Separate Understandability]] (PSU): When building inheritance hierarchies, | ||
Line 56: | Line 65: | ||
{{page> | {{page> | ||
{{page> | {{page> | ||
+ | |||
===== Example ===== | ===== Example ===== | ||
Line 65: | Line 75: | ||
/ | / | ||
/ | / | ||
+ | |||
===== Further Reading ===== | ===== Further Reading ===== | ||
- | * Robert C. Martin: //Agile Software Development, | + | * Robert C. Martin: //Agile Software Development, |
* [[http:// | * [[http:// | ||
+ | * [[wiki> | ||
+ | * [[wp> | ||
+ |
principles/liskov_substitution_principle.txt · Last modified: 2021-10-18 21:50 by christian