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.

204<br />

Saturday Evening<br />

When the current condition, or state, of the account is overdrawn, the account will<br />

respond differently than when the account is in the open condition — checks will be<br />

rejected rather than paid or the bank will cover the check and charge you an exorbitant<br />

fee for its kindness.<br />

Tip<br />

The Statechart has been around a long time. You may know it by the name<br />

state diagram, state machines, or state transition diagram.<br />

Next, contrast the scope of the Statechart with that of the Sequence diagram. The scope<br />

of the Statechart is the entire life of an object. The scope of the Sequence diagram is a single<br />

scenario. Consequently, it is possible to derive a Statechart from the set of Sequence<br />

diagrams that use the object.<br />

The Statechart models the events that trigger a transition (change) from one state to<br />

another state. Each event may have a corresponding action that makes the changes in the<br />

object (that is, alters the attribute values). While an object is in a state, it may also perform<br />

work associated with that state. Such work is called an activity.<br />

The Statechart can also be used to model concurrent activities within a state by creating<br />

parallel substates within a superstate. Using the substate and superstate notation, you can<br />

explicitly identify split and merge of control for concurrency.<br />

Defining the Fundamental Notation for a Statechart Diagram<br />

The foundation for the Statechart is the relationship between states and events. The following<br />

examples illustrate the Statechart notation using the Order object. A state is modeled as<br />

a rounded rectangle with the state name inside, as in Figure 20-1, much like the short form<br />

of the class icon, where only the name compartment is visible.<br />

Filled<br />

Figure 20-1 State symbol with only name compartment shown (minimum<br />

configuration)<br />

The initial state of an object has its own unique notation, a solid dot with an arrow<br />

pointing to the first state. The initial state indicates the state in which an object is created<br />

or constructed. You would read Figure 20-2 to say, “An Order begins in the ‘Placed’ state.” In<br />

other words, the Order comes into existence when a customer places it.<br />

Placed<br />

Figure 20-2<br />

The initial state notation

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

Saved successfully!

Ooh no, something went wrong!