Indicating Order of Execution on a Diagram


You use state diagrams to indicate flow of control. As you develop state diagrams, you indicate what sequence of behavior is allowed for an object. When an event arrives at your object, the state diagram shows just what happens next.

 Warning   Be careful how you put your state diagrams together. You want to make sure that operations happen in the right order. To help you determine the sequence of behavior, pay attention to the flow of control specified by the meaning of UML’s state-diagram notation.

Figure 17-8 shows a small piece of the CustomerAccount state diagram. If an instance of the CustomerAccount is in the Idle state, and the open event is received by the instance, then the following sequence of actions occurs:


Figure 17-8: Flow of control in a state diagram.

  1. An action on the incoming event: display(“validating”).

  2. An entry action: entry/theCreditCard.valid.

  3. The actions of all deferred events: none for the Validating state.

    Note, however, that when the object makes the transition to the Cancel state, the statement event may be handled then—provided it arrived during the Validating state.

  4. A do activity(the main behavior of the state): do/wait for validation.

  5. Internal actions: customer / return(customer).

    The internal event interrupts the do activity and performs its action. Then control returns to allow the do activity to pick up right where it left off.

  6. An exit action: exit/dateOpened := Today.

    The exit action is performed only after the object receives the notValid event, causing the object to make the transition out of the Validating state.

  7. Action on the outgoing event: display(“Invalid Credit Card”).




UML 2 for Dummies
UML 2 For Dummies
ISBN: 0764526146
EAN: 2147483647
Year: 2006
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net