Design by Contract (DbC) treats the relationship between a method and its caller as a formal agreement, defined by three things: preconditions (what the caller must guarantee), postconditions (what the method guarantees in return), and invariants (what stays true for the object at all times).
The three obligations
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
