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 20—Modeling the Dynamic View: The Statechart Diagram 205<br />

Note that the initial state is the entire image in Figure 20-2. It includes the dot, the<br />

arrow, and the state icon. In effect, the dot and arrow point to the first state.<br />

The Statechart event notation is a line style arrow connecting one state to another state.<br />

The arrow is actually the transition associated with the event. The direction of the arrow<br />

shows the direction of the change from one state to another. Figure 20-3 shows the event<br />

“products available” that causes the transition (the arrow) from the state “Placed” to the<br />

state “Filled.”<br />

Placed<br />

products available<br />

Filled<br />

Figure 20-3 The state transition from “Placed” to “Filled”<br />

An action is associated with an event. An action is the behavior that is triggered by the<br />

event and it is the behavior that actually changes the attributes that define the state of the<br />

object. <strong>To</strong> model the action, place a forward slash after the event name followed by the name<br />

of the action or actions you want performed, as in Figure 20-4 where the “products available”<br />

event triggers the fillOrder() action. The act of filling the Order alters its contents and redefines<br />

its state.<br />

An action is an atomic task, and as such it cannot be broken into component tasks, nor<br />

can it be interrupted. There are no break points within it and, furthermore, stopping it<br />

midway would leave the object state undefined.<br />

Placed<br />

products available/fillOrder()<br />

Filled<br />

Figure 20-4 Event/action pair<br />

An object may reach a final state from which it may not return to an active state. In<br />

other words, you would never see an arrow going out of this state. A common usage is<br />

shown in Figure 20-5. The Order may be archived from either state. But after it is archived,<br />

you may never change it. You may still see it and it may still exist, but you can no longer<br />

alter its state. The final state may also mean that the object has actually been deleted.<br />

Cancelled<br />

Filled<br />

Archived<br />

Figure 20-5<br />

The final state notation

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

Saved successfully!

Ooh no, something went wrong!