Section 14.2. States


14.2. States

A state is a condition of being at a certain time. A state can be a passive quality, such as On and Off for the light object. A state can also be an active quality, or something that an object is doing. For example, a coffeemaker has the state Brewing during which it is brewing coffee. A state is drawn as a rounded rectangle with the name of the state in the center, as shown in Figure 14-4.

Figure 14-4. A rectangle with rounded corners and the name in the center is the most common way to draw a state


If the state is a "doing" state, you can write the behavior inside the state, as shown in Figure 14-5.

Figure 14-5. Showing the behavior details of a "doing" state


Do behavior, written as do/behavior, is behavior that happens as long as the state is active. For example, the coffeemaker in Figure 14-5 does the behavior brew coffee while in the Brewing state. Similarly, a CD player could have the behavior do/read disc while in the Playing state. Do behavior either completes on its own or is forced to complete when a trigger causes the state to exit, as discussed in "Transitions." Later in this chapter, you'll see additional ways to show details of a state, including entry and exit behavior, reactions to events within a state, and states within states.




Learning UML 2.0
Learning UML 2.0
ISBN: 0596009828
EAN: 2147483647
Year: 2007
Pages: 175

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