Object Intercommunication

Objects communicate by exchanging messages. When it receives a message, the target object triggers an operation to deal with it. The message is a very general concept that may represent a procedure call, an interrupt coming from the hardware, or a dynamic link.

Messages are the way to visualize the exchange within object interaction diagrams — both sequence and collaboration diagrams. These diagrams show particular behavior cases within a use case.

State machines represent behavioral abstractions from the point of view of a group of objects (most often, a class). The behavior described by scenarios is the specific result of the states of all the objects that collaborate within those scenarios.

Message broadcasts between two objects are represented within the statechart diagram formalism in an abstract way, by sending an event between the final state machines of the classes of the objects concerned. The display within statechart diagrams is more abstract because every event sent between two state machines corresponds to many message broadcasts between objects.

The syntax of an event broadcast towards a class takes the form:

^ Target.Message (Arguments)

Here, Target refers to the class of the objects that are targets of the event, and Message is the name of a message the target will understand.

The complete syntax of a transition is therefore:

Event (Arguments)[Condition] / Action ^ Target.Message (Arguments)

The following example shows state machine fragments of a TV set and its remote control. The TV set may be turned on or off by manipulating a flip switch, and the remote control has a pushbutton. The TV set may be controlled directly or using the remote control.

Broadcasting towards any set of objects is possible using generalization. (A class is a particular example of a set of objects.) The most usual kinds are the broadcast to all the objects (spreading) and the broadcast to a particular object (point to point). In the case of a state machine that describes a composite class, the actions may make direct reference to the operations that are declared in the various classes contained within the composite class.

© 1997 Editions, Eyrolles, Paris, France . All rights reserved.