Chapter 5 Building Dynamic Diagrams


Messages

A message is a communication between objects. The receipt of a message will normally have an outcome.

A message can be created in the following diagrams:

Objects can cooperate by using several kinds of requests (send a signal, invoke an operation, create an object, delete an existing object, etc.). Sending a signal is used to trigger a reaction from the receiver in an asynchronous way and without a reply. Invoking an operation will apply an operation to an object in a synchronous or asynchronous mode, and may require a reply from the receiver. All these requests constitute messages. They correspond to stimulus in the UML language.

A message has a sender, a receiver, and an action. The sender is the object or actor that sends the message. The receiver is the object or actor that receives the message. The action is executed on the receiver. You can also create recursive messages, where the same object is the sender and receiver.

The message symbol is an arrow showing its direction, and can also display the following information:

Reusing Messages

The same message can be used in a sequence and a collaboration diagram or in multiple diagrams of either type. When you drag a message from one diagram to another, it is dropped with both extremities if they do not exist, and (in a collaboration diagram) it is attached to a default instance link.

The sequence number attached to a message is identical in all diagrams if the message is reused.

When you copy a message, its name does not change. You can either keep its original name, or rename the message after copy.

Any change on the Action or Control Flow value of the message is reflected in all diagrams. However, if the change you want to perform is not valid, the change will not be possible. For example, you are not allowed to move a Create message if a Create message already exists between the sender and the receiver.

Messages in a collaboration diagram

In a collaboration diagram, each message is associated with an instance link. An instance link may have several associated messages, but each message can be attached to only one instance link. The destruction of an instance link destroys all the messages associated with it.


Messages in a sequence diagram

A message is shown as a horizontal solid arrow from the lifeline of one object or actor, to the lifeline of another. The arrow is labeled with the name of the message. You can also define a control flow type that represents both the relationship between an action and its preceding and succeeding actions, and the waiting semantics between them.

In a sequence diagram you can choose between the following types of messages:

You can create activations on the lifeline of an object to represent the period of time during which it is performing an action.

A message can be drawn from an actor to an object, or inversely. It is also possible to create a message between two actors but it will be detected, and displayed as a warning during the check model process.

Note   Using a note and a link
If you need to fully describe, or put a label on a message, you can write a note using the Note tool, and position the note close to the message.

 


Copyright (C) 2006. Sybase Inc. All rights reserved.