Design by Contract
Originally introduced by Bertrand Meyer in the Eiffel language, the design by contract technique is the specification of formal, written contracts for every deliverable (use case, CRC card, code, interface, etc.) and process. These contracts can have five clauses:
Preconditions: The conditions that have to be true before this deliverable can be used or before this step in the process can be performed.
Postconditions: The conditions that will be true after this deliverable is used or after this step in the process is performed.
Invariants: The rules and policies that govern the performance of this deliverable or step in the process.
Error: The behaviors of this hardware or software deliverable under various error conditions.
Exception: The exceptions to the rules and policies that govern the performance of this deliverable or step in the process.
The design by contract technique is an invaluable aid to communicating the responsibilities of each deliverable and step in the systems development process; it is also useful as a formal test acceptance criteria and as a guide to the reuse of deliverables and steps in the development process. Natural language is usually sufficient to specify the contract, although formal specification languages should be used in life-critical systems.