Common UML Interaction Diagram Notation - UML

Illustrating Participants with Lifeline Boxes

In the UML, the boxes you've seen in the prior sample interaction diagrams are called lifelineboxes. Their precise UML definition is subtle, but informally they represent the participantsin 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 for common cases of notation.

Lifeline boxes to show participants in interactions

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:

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:

initialize(code)
initialize
d = getProductDescription(id)
d = getProductDescription(id:ItemID)
d = getProductDescription(id:ItemlD) : ProductDescription

Singleton Objects

In the world of 00 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.

Singletons in interaction diagrams

Singletons in interaction diagrams


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

UML Topics