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.

232<br />

Sunday Morning<br />

A substate is a state within a state, a lower level of detail within a state. For example, a<br />

car can be in the state of moving forward. Within the moving forward superstate are substates<br />

of moving forward in first gear, moving forward in second gear, and so on. The substates<br />

provide a low-level view of a model element so that you can address specific issues<br />

individually and in terms of their interactions and interdependencies. This detailed view<br />

also allows you to highlight concurrent states and focus on how to control the splitting and<br />

merging of concurrent states.<br />

<strong>To</strong> illustrate these concepts, I’m going to use what I hope is a familiar example, a thermostat.<br />

I’m going to simplify it even further and only look at the cooling side of its responsibilities.<br />

The thermostat is a typical control-type object. Its job is to direct the work of<br />

other objects, much like an application directs the behavior of the screen and the access to<br />

the database.<br />

Figure 22-7 models the superstate Cooling with two concurrent substates. In this example,<br />

the two substates are both initial states. The diagram says that when the Thermostat<br />

enters the Cooling state, it splits into two concurrent substates, that is, it is now doing two<br />

things at the same time: It is monitoring the progress of the cooling process, and it is monitoring<br />

the cooling device for any problems. The two substates start immediately upon entering<br />

the Cooling state.<br />

Cooling<br />

Monitor Cooling<br />

Monitor Device<br />

Figure 22-7 Superstate Cooling with two substates, Monitor Cooling and Monitor<br />

Device<br />

It is also possible to trigger the substates by transition events like a call or time event.<br />

In this case, the transition event would extend all the way into the superstate and point<br />

directly to the substate. This often involves split of control, which I cover next.<br />

Split of control<br />

Split of control means that, based on a single transition, you want to proceed with multiple<br />

tasks. This is exactly the same concept you learned in the Activity diagram session. Split of

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

Saved successfully!

Ooh no, something went wrong!