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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Session 23—Applying the Extended Statechart Features to the Case Study 239<br />

Understanding these concepts is a lot easier when you can see an example, so I’m going<br />

to derive a Statechart diagram for the Product object and do it a step at a time so you can<br />

see the progression. I’ll work through the same series of steps for each scenario:<br />

1. Identify the events directed at the lifeline of the Product object.<br />

2. Identify candidate states by isolating the gaps of the lifeline between the incoming<br />

events.<br />

3. Name the candidate states using adjectives that describe the condition of the<br />

object during the period of time represented by the gap.<br />

4. Add the new states and events to the Product Statechart.<br />

The first scenario is modeled in Figure 23-3. There is one incoming event called<br />

Product(PO). This is the constructor operation that creates the object. Before this event,<br />

this particular Product object didn’t exist, so you have discovered the initial state. I’ll name<br />

it “On Order” to show that a record of the Product object is created when the Product is first<br />

ordered.<br />

The self-transition event setPO(PO) does not change the state of the Product. It only<br />

updates a reference that it’s tracking, so I didn’t identify a state change.<br />

:PurchasingClerk :PurchaseOrder :Product<br />

1:PO()<br />

2:PurchaseOrder<br />

3:Product(PO)<br />

does not exist yet<br />

Draft Statechart<br />

Diagram<br />

On Order<br />

4:setPO(PO)<br />

5:Product<br />

6:addProduct(Product)<br />

Initial state<br />

On Order<br />

7:return true<br />

Figure 23-3 Finding the transition events and candidate states for Scenario 1

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

Saved successfully!

Ooh no, something went wrong!