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 211<br />

REVIEW<br />

The Statechart diagram models the life of a single object. The fundamental elements of a<br />

Statechart are states and events. A state represents the condition of the object. The state is<br />

recorded in the values of one or more of the attributes of the object. An event triggers a<br />

change in state, a transition. An action is a behavior triggered by an event, the behavior<br />

that actually makes the changes to the attribute values that redefine the state of the<br />

object.<br />

The process for building a Statechart is as follows:<br />

1. Identify the state that the object is in when it is first created. Model the initial<br />

state.<br />

2. Identify the event(s) that change the object from the initial state to some other<br />

state.<br />

3. Name the new state.<br />

4. Draw the transition from the first state to the second. Label the transition arrow<br />

with the event that triggers the transition.<br />

5. Identify the action(s) associated with the event and that actually change the<br />

object attributes. Add the action after the event name and preceded by a forward<br />

slash.<br />

6. Continue the process with each new event until all events have been accounted<br />

for.<br />

7. If there is a state from which the object can never leave, convert this state to the<br />

final state notation.<br />

QUIZ YOURSELF<br />

1. What does a Statechart illustrate (See “Describing the Purpose and Function of<br />

the Statechart Diagram.”)<br />

2. How do you model a transition from one state to another state (See “Defining the<br />

Fundamental Notation for a Statechart Diagram.”)<br />

3. How do you model the state an object is in when it is first created (See “Defining<br />

the Fundamental Notation for a Statechart Diagram.”)<br />

4. How do you model the behavior initiated by an event and that actually makes the<br />

changes in the object’s state (See “Building a Statechart Diagram.”)<br />

5. How do you model work that an object performs while it is a state (See “Defining<br />

Internal Events and Activities.”)

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

Saved successfully!

Ooh no, something went wrong!