Home > Articles > Software Development & Management > Object Technology

  • Print
  • + Share This
This chapter is from the book

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:

  1. Preconditions: The conditions that have to be true before this deliverable can be used or before this step in the process can be performed.

  2. Postconditions: The conditions that will be true after this deliverable is used or after this step in the process is performed.

  3. Invariants: The rules and policies that govern the performance of this deliverable or step in the process.

  4. Error: The behaviors of this hardware or software deliverable under various error conditions.

  5. 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.

  • + Share This
  • 🔖 Save To Your Account