01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Session 5—Understanding the Use Case Model 57<br />

When one Use Case delegates to another, the dependency is drawn as a dashed arrow<br />

from the “using” Use Case to the “used” Use Case and labeled with the stereotype<br />

notation, as shown in figure 5-8. This conveys that executing the “using” (or calling)<br />

Use Case will include or incorporate the functionality of the “used” Use Case. If you have a<br />

programming background, you see right away the correlation with subroutine or function<br />

calls.<br />

Delegation may occur for one of two reasons. First, another Use Case may already exist to<br />

perform the task that is needed. Second, a number of Use Cases may need to perform the<br />

same task. Rather than write the same logic multiple times, the common task is isolated<br />

into its own Use Case and reused by, or included into, each Use Case that needs it.<br />

Customer<br />

Withdraw Cash<br />

<br />

Update Account<br />

Withdraw Cash<br />

with Overdraft<br />

Protection<br />

Protect Overdraft<br />

Figure 5-8<br />

dependency notation for the Use Case diagram<br />

dependency notation<br />

The dependency stereotype says that one Use Case might need help from<br />

another Use Case. In contrast, the dependency stereotype says that one Use<br />

Case will always call the other Use Case. Somewhere in the logic of the Use Case that needs<br />

the help is an extension point, a condition test that determines whether or not the call<br />

should be made. There is no such condition in an include dependency.<br />

The other contrast between the two dependency stereotypes is the direction of the<br />

dependency arrow. The dependency arrow points from the main Use Case (the<br />

one currently executing) to the one that it needs help from. The dependency<br />

arrow points from the extension Use Case (the one providing the extra help) to the main<br />

Use Case that it is helping (see Figure 5-9).<br />

If you read the basic definition of a dependency, the dependency arrow<br />

seems to be backwards. That is one reason I often put an “s” on the end of these stereotypes.<br />

For example, the Withdraw Cash Use Case Update Account (the<br />

Withdraw Cash Use Case will always update the account). Likewise, the Protect Overdraft<br />

Use Case Withdraw Cash (the Protect Overdraft Use Case will sometimes be<br />

called by the Withdraw Cash Use Case).<br />

The extend dependency can be confusing for Java programmers who use “extends” to<br />

achieve inheritance. These two concepts have nothing in common. The <strong>UML</strong> provides a<br />

separate notation for inheritance (or generalization).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!