Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there a difference between design-by-contract and the condition modifications allowed by the Liskov substitution principle? They seem related but I'm not well-enough versed in the differences.

"...the subtype must meet a number of behavioral conditions. These are detailed in a terminology resembling that of design by contract methodology, leading to some restrictions on how contracts can interact with inheritance:

Preconditions cannot be strengthened in a subtype.

Postconditions cannot be weakened in a subtype.

Invariants of the supertype must be preserved in a subtype."

http://en.wikipedia.org/wiki/Liskov_substitution_principle



They are the same.

I was generalizing and though only about pre-conditions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: