Commands and queries identified in the system sequence diagram must be implemented. Contracts are high-level specifications for those operations. They may be written in natural language or in a formal language such as OCL. This chapter presents a writing discipline for OCL contracts that avoids ambiguous interpretations and that is relatively easy to read and write. Contracts are composed of preconditions, postconditions, exceptions, and return values. Contracts for CRUDs are presented as well as contracts for other operations found in system sequence diagrams.
System operation contract; precondition; postcondition; exception; formal specification; OCL; Object Constraint Language