Lifelines in UML diagrams

In UML diagrams, such as sequence or communication diagrams, lifelines represent the objects that participate in an interaction. For example, in a banking scenario, lifelines can represent objects such as a bank system or customer. Each instance in an interaction is represented by a lifeline.

Lifelines in sequence diagrams

As the following figure illustrates, a lifeline in a sequence diagram is displayed with its name and type in a rectangle, which is called the head. The head is located on top of a vertical dashed line, called the stem, which represents the timeline for the instance of the object.

This image shows a lifeline as it appears in a sequence diagram, with its parts labeled.

Messages, which are sent and received by the instance, appear on the lifeline in sequential order. You can create new lifelines, create lifelines from existing elements, or assign element types to existing lifelines.

As the following table illustrates, lifelines can indicate several actions in sequence diagrams.

Behavior Description
Creation You can create an instance in an interaction by using a create message. The create message enables an object to create new objects in the sequence diagram.
Communication You indicate messages with arrows between instances. The arrow originates from the source lifeline that sends the message and ends at the target lifeline that receives it.
Execution An execution specification shows the length of a behavior of an operation directly or through a subordinate operation.
Destruction You can destroy an instance during an interaction by using a destroy message or a stop node. A destroy message is a message that ends the target lifeline. A stop node, represented by an X, marks the end of the stem of the lifeline to indicate the lifeline has ended.

Lifelines in communication diagrams

As the following figure illustrates, a lifeline in a communication diagram is represented by a rectangle that contains the instance name and the type.

This image shows a lifeline as it appears in a communication diagram.

Feedback