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.

240<br />

Sunday Morning<br />

The second scenario, modeled in Figure 23-4, shows the receiving event. There is only<br />

one event hitting the Product lifeline, so I identify two candidate states: the one before the<br />

event and the one after. The event receive(location) becomes the reason for the transition<br />

from On Order to Inventoried.<br />

:ReceivingClerk :Shipment :Product<br />

1:getNextProduct()<br />

2:return Product<br />

On Order<br />

3:receive(location)<br />

On Order<br />

receive(location)<br />

4:return true<br />

Inventoried<br />

Inventoried<br />

Figure 23-4 Finding the transition events and candidate states for Scenario 2<br />

If you’re struggling with a name for the state, try to identify the attributes<br />

that change in the transition and use them and their values as the descriptors.<br />

For example, if the cancelled date is set, then call it Cancelled; if the<br />

Tip<br />

product was placed into inventory by entering a location value in the location<br />

attribute, call it Inventoried.<br />

The third scenario, in Figure 23-5, shows the Product being sold. Before the sell event,<br />

the Product was sitting in inventory. In fact, if it were not in inventory, I could not sell it.<br />

So again, I identify two states and use the incoming event sell as the transition event<br />

between the two states.

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

Saved successfully!

Ooh no, something went wrong!