Design by Contract (DbC) traktuje relację między metodą a jej wywołującym jako formalną umowę, zdefiniowaną trzema rzeczami: preconditions (co musi zagwarantować wywołujący), postconditions (co metoda gwarantuje w zamian), i invariants (co pozostaje prawdziwe dla obiektu przez cały czas).
Trzy obowiązki
PRECONDITION → caller's duty: inputs/state the method requires to run correctly
POSTCONDITION → method's duty: what it promises on return (if precondition held)
INVARIANT → always-true property of the object, before and after every method
