UML Sequence Diagrams

During the requirements analysis phase, the system can be treated as a single "black box", which means that we can look at the system's behavior (what it does) without explaining how it does it. Read this section to see an example of a simplified trace diagram that shows only system input events. This is called a system sequence diagram.

13. Contracts for Some Operations in POST system

Tables 3.12 and 3.13 show examples contracts for “enterItem” operation and “makePayment” operation of the POST system.

Table 3.12: Contract for enterItem Operation Contract

Name enterItem(upc:UPC, quantity:Integer):
Responsibilities: Enter (or record) sale of an item and add it to the sale. Display the item description and price.
Type: System
Cross References: System Functions: R1.1, R1.3, R1.9
Use Cases, Buy Items:
Note: Use superfast database access.
Exceptions: If the UPC is not valid, indicate that it was an error.
Output:
Pre-conditions: UPC is known to the system.


Table 3.13: Contract for makePayment Operation

Name makePayment(amount: Quantity).
Responsibilities: Record the payment, calculate balance and print receipt
Type: System
Cross References: System Functions: R2.1
Use Cases: Buy Items
Note: Use superfast database access
  • If sale is not complete, indicate that it was an error
  • If the amount is less than the sale total, indicate an error.
Output:
Pre-conditions:
Post-conditions: 1. A Payment was created (instance creation).
2. Payment.amountTendered was set to amount (attribute medication).
3. The Payment was associated with the Sale (association formed)
4. The Sale was associated with the Store, to add it to the historical log of completed sales (association formed).