Page 204 -
P. 204
7.1 Object-oriented design using the UML 187
this request. The stick arrowhead on the sent message indicates that the external
system does not wait for a reply but can carry on with other processing.
2. SatComms sends a message to WeatherStation, via a satellite link, to create a
summary of the collected weather data. Again, the stick arrowhead indicates
that SatComms does not suspend itself waiting for a reply.
3. WeatherStation sends a message to a Commslink object to summarize the
weather data. In this case, the squared-off style of arrowhead indicates that the
instance of the WeatherStation object class waits for a reply.
4. Commslink calls the summarize method in the object WeatherData and waits for
a reply.
5. The weather data summary is computed and returned to WeatherStation via the
Commslink object.
6. WeatherStation then calls the SatComms object to transmit the summarized
data to the weather information system, through the satellite communications
system.
The SatComms and WeatherStation objects may be implemented as concurrent
processes, whose execution can be suspended and resumed. The SatComms object
instance listens for messages from the external system, decodes these messages and
initiates weather station operations.
Sequence diagrams are used to model the combined behavior of a group of
objects but you may also want to summarize the behavior of an object or a subsystem
in response to messages and events. To do this, you can use a state machine model
that shows how the object instance changes state depending on the messages that it
receives. The UML includes state diagrams, initially invented by Harel (1987) to
describe state machine models.
Figure 7.8 is a state diagram for the weather station system that shows how it
responds to requests for various services.
You can read this diagram as follows:
1. If the system state is Shutdown then it can respond to a restart(), a reconfigure(),
or a powerSave() message. The unlabeled arrow with the black blob indicates
that the Shutdown state is the initial state. A restart() message causes a transition
to normal operation. Both the powerSave() and reconfigure() messages cause a
transition to a state in which the system reconfigures itself. The state diagram
shows that reconfiguration is only allowed if the system has been shut down.
2. In the Running state, the system expects further messages. If a shutdown() mes-
sage is received, the object returns to the shutdown state.
3. If a reportWeather() message is received, the system moves to the Summarizing
state. When the summary is complete, the system moves to a Transmitting state
where the information is transmitted to the remote system. It then returns to the
Running state.