Contracts
Precondition | Postcondition | Check | Invariant | Loop | |
---|---|---|---|---|---|
ABAP Objects | |||||
C++ (STL) | |||||
C# | Spec#: type foo( «parameters» ) requires expression { body } |
Spec#: type foo( «parameters» ) ensures expression { body } |
|||
Java | |||||
Objective-C | |||||
Visual Basic .NET | |||||
D | f in { expression } body{ instructions } | f out (result) { expression } body{ instructions } | invariant { expression } | ||
Eiffel | f require tag: expression do end |
f do ensure tag: expression end |
f do check tag: expression end end |
class X invariant tag: expression end |
from instructions invariant tag: expression until expr loop instructions variant tag: expression end |
Python | |||||
PHP | |||||
Perl | |||||
Perl 6 | PRE { condition } | POST { condition } | |||
Ruby | |||||
Windows PowerShell | |||||
OCaml | |||||
F# |
Read more about this topic: Comparison Of Programming Languages (object-oriented Programming)
Famous quotes containing the word contracts:
“If love closes, the self contracts and hardens: the mind having nothing else to occupy its attention and give it that change and renewal it requires, busies itself more and more with self-feeling, which takes on narrow and disgusting forms, like avarice, arrogance and fatuity.”
—Charles Horton Cooley (18641929)
“Bankers, nepotists, contracts and talkies: on four fingers one may count the leeches which have sucked a young and vigorous industry into paresis.”
—Dalton Trumbo (19051976)