Many classes have instances that are created and deleted over time. We can model creation and deletion of objects in the state machines. 9.4.1 Initial PseudostatesThe semantics of UML state machine instance-creation are as follows: First, an object is created, then the state machine instance is started, then the state machine instance is ready to receive events. The state machine instance is started in its initial pseudostate. Definition: An initial pseudostate is the state in which the state machine instance for an object is started. An initial pseudostate is shown by a filled-in circle, as in Figure 9.10. Several transitions may emanate from the initial pseudostate, so long as each is caused by a different event, just as with any other state. 9.4.2 Final PseudostatesA state machine instance and its corresponding object are implicitly deleted when a state machine instance makes a transition to a final pseudostate. Definition: A final pseudostate is the state in which an object is deleted. Final pseudostates are indicated on the statechart diagram by a bulls-eye symbol. The unlabeled transition to the final pseudostate is a completion event. As soon as the final state's procedure completes, the instance transitions to the final pseudostate and goes away. In addition, state machines may have one or more states in which they become quiescent. In a quiescent state, the object continues to exist, but has no subsequent interesting dynamic behavior. While no special notation is used on the statechart diagram, such final states can be identified by their lack of outbound transitions.
Examples of each construct are shown in Figure 9.10. Note that part of abstraction is distinguishing between application behavior and computer behavior. For example, in many financial systems accounts never really go away. Instead they are archived for posterity (or the IRS). |