principles:liskov_substitution_principle
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
principles:liskov_substitution_principle [2018-05-27 18:40] – 2600:6c56:7a00:e45:0:7bb6:125a:4a85 | principles:liskov_substitution_principle [2020-10-12 16:23] – old revision restored (2013-05-19 22:09) 159.69.186.191 | ||
---|---|---|---|
Line 6: | Line 6: | ||
===== Context ===== | ===== Context ===== | ||
/* fill in contexts here: */ | /* fill in contexts here: */ | ||
- | * [[contexts: | + | * [[contexts: |
- | * [[contexts: | + | |
Line 17: | Line 16: | ||
===== Description ===== | ===== Description ===== | ||
- | Object-oriented programming languages | + | Object-oriented programming languages |
- | The programming language does not enforce that the subtype behaves like the supertype. Method '' | + | But the programming language does not enforce that the subtype |
Line 26: | Line 25: | ||
===== Rationale ===== | ===== Rationale ===== | ||
- | Let '' | + | |
===== Strategies ===== | ===== Strategies ===== | ||
* Only strengthen invariants in subclasses; never weaken them | * Only strengthen invariants in subclasses; never weaken them | ||
- | * Only weaken | + | * Only waken preconditions when overriding methods |
* Only strengthen postconditions when overriding methods | * Only strengthen postconditions when overriding methods | ||
* Use Delegation instead of Inheritance | * Use Delegation instead of Inheritance | ||
Line 81: | Line 80: | ||
===== Description Status ===== | ===== Description Status ===== | ||
/* Choose one of the following and comment out the rest: */ | /* Choose one of the following and comment out the rest: */ | ||
- | /*[[wiki: | + | [[wiki: |
- | [[wiki: | + | /*[[wiki: |
/ | / | ||
Line 94: | Line 93: | ||
* Barbara H. Liskov , Jeanette M. Wing: // | * Barbara H. Liskov , Jeanette M. Wing: // | ||
* Barbara H. Liskov , Jeanette M. Wing: // | * Barbara H. Liskov , Jeanette M. Wing: // | ||
- | |||
- | ===== Discussion ===== | ||
- | |||
- | Discuss this wiki article and the principle on the corresponding [[talk: |
principles/liskov_substitution_principle.txt · Last modified: 2021-10-18 21:50 by christian