13.2. Example Contract: enterItem
Before examining the reason to write a contract, an example is worthwhile. The following describes a contract for the enterItem system operation.
| Operation: | enterItem(itemID : ItemID, quantity : integer) | | Cross References: | Use Cases:
Process Sale | | Preconditions: | There is a sale underway. | | Postconditions: | - A SalesLineItem instance sli was created (instance creation). - sli was associated with the current Sale (association formed). - sli.quantity became quantity (attribute modification). - sli was associated with a ProductSpecification, based on itemID match (association formed).
|
|