Sams Teach Yourself C++ in 21 Days

(singke) #1
The <<extends>>use case was intended to indicate conditional relationships and some-
thing akin to inheritance, but so much confusion exists in the object-modeling commu-
nity about the distinction between <<uses>>and <<extends>>that many developers have
simply set aside <<extends>>, feeling that its meaning is not sufficiently well under-
stood. Personally, I use <<uses>>when I would otherwise copy and paste the entire use
case in place, and I use <<extends>>when I only usethe use case under certain defin-
able conditions.
Interaction Diagrams Although the diagram of the use case itself might be of lim-
ited value, you can associate diagrams with the use case that can dramatically improve
the documentation and understanding of the interactions. For example, you know that the
Withdraw Cash scenario represents the interactions among the following domain objects:
customer, checking account, and the user interface. You can document this interaction
with an interaction diagram (also called a collaboration diagram), as shown in
Figure 11.11.

346 Day 11


FIGURE11.11
UML interaction
diagram.

Customer User-Interface(ATM) Checking Account

1: Request Withdrawal

2: Show options

3: Indicate amount and account
4: Check Balances, status, etc.

5: Return Authorization

6: Debit $300
7: Dispense cash

8: Request receipt

9: Print Receipt

The interaction diagram in Figure 11.11 captures details of the scenario that might not be
evident by reading the text. The objects that are interacting are domainobjects, and the
entire ATM/UI is treated as a single object, with only the specific bank account called
out in any detail.
Free download pdf