Sample Use Case (From Cay Horstman's Object-Oriented Design & Patterns), ---------------- Leave a Message 1. The caller dials the main number of the voice mail system. 2. The voice mail system speaks a prompt: "Enter mailbox number followed by #." 3. The user types in the extension number of the message recipient. 4. The voice mail system speaks: "You have reached mailbox xxxx. Please leave a message now. 5. The caller speaks the message. 6. The caller hangs up. 7. The voice mail system places the recorded message in the recipient's mailbox. Variation #1 1.1 In step 3, the user enters an invalid extention number. 1.2 The voice mail system speaks: "You have typed an invalid mailbox number." 1.3 Continue with Step 2. Variation #2 2.1 After Step 4, the caller hangs up instead of speaking a message. 2.2 The voice mail system discards the empty message. Next, consider the aggregation relationships. We know the following: -- A mail system has mailboxes (MailSystem object manages mailboxes) -- A mailbox has two message queues -- A message queue has some number of messages -- A Connection has a current mailbox (that is found through the MailSystem). It also has references to the MailSystem and Telephone object that it connects. The Connection object gets input from the Telephone object, carries out the "use" commands and keeps track of state. The Telephone object takes "use" input and speaks the output. +------------+ +-----------+ | | 1 1 | | | MailSystem |<>-------| Mailbox | | | | Container | +------------+ | | | 1 +-----------+ | / \ 1 | \ / | | | | | 1 | / \ | \ / | * +------------+ +---------+ +---------+ | | | | 1 2 | | +-----<>| Manager | | Mailbox |<>-----------| Message | | 1 | | | | | Queue | | +------------+ +---------+ +---------+ | / \ 1 / \ | \ / \ / | | 1 | | | +---------+ | | | | | * | | 1 | | Message |------------------+ +-----------+ | 1 | | | | +--------------+ +---------+ | Telephone | | | | | | Connection | +-----------+ | | +--------------+