Home > Articles > Software Development & Management > UML

  • Print
  • + Share This
This chapter is from the book

15.3 Common UML Interaction Diagram Notation

Illustrating Participants with Lifeline Boxes

In the UML, the boxes you've seen in the prior sample interaction diagrams are called lifeline boxes. Their precise UML definition is subtle, but informally they represent the participants in the interaction—related parts defined in the context of some structure diagram, such as a class diagram. It is not precisely accurate to say that a lifeline box equals an instance of a class, but informally and practically, the participants will often be interpreted as such. Therefore, in this text I'll often write something like "the lifeline representing a Sale instance," as a convenient shorthand. See Figure 15.5 for common cases of notation.

15fig05.gifFigure 15.5 Lifeline boxes to show participants in interactions.

Basic Message Expression Syntax

Interaction diagrams show messages between objects; the UML has a standard syntax for these message expressions: [2]

return = message(parameter : parameterType) : returnType

Parentheses are usually excluded if there are no parameters, though still legal.

Type information may be excluded if obvious or unimportant.

For example:

   d = getProductDescription(id)
   d = getProductDescription(id:ItemID)
   d = getProductDescription(id:ItemID) : ProductDescription

Singleton Objects

In the world of OO design patterns, there is one that is especially common, called the Singleton pattern. It is explained later, but an implication of the pattern is that there is only one instance of a class instantiated—never two. In other words, it is a "singleton" instance. In a UML interaction diagram (sequence or communication), such an object is marked with a '1' in the upper right corner of the lifeline box. It implies that the Singleton pattern is used to gain visibility to the object—the meaning of that won't be clear at this time, but will be upon reading its description on p. 442. See Figure 15.6.

15fig06.gifFigure 15.6 Singletons in interaction diagrams.


Singleton p. 442

  • + Share This
  • 🔖 Save To Your Account