Lifelines
A lifeline is a notation that represents the existence of an object or classifier role over a period of time. Lifelines appear only in sequence diagrams, where they show how each instance (object or classifier role) participates in the interaction.
For example, a "Place Online Order" interaction in an e-commerce application includes a number of lifelines in a sequence diagram, including lifelines for a ":Cart" object, ":OnlineOrder" object, and ":CheckoutCart" object. As the interaction is developed, stimuli are added between the lifelines.
Shape
A lifeline appears as a vertical dashed line in a sequence diagram.
|
Using Lifelines
When a classifier role or object appears in a sequence diagram, it will automatically have a lifeline. Lifelines indicate the following:
-
Creation – If an instance is created during the interaction, its lifeline starts at the level of the message or stimulus that creates it; otherwise, its lifeline starts at the top of the diagram to indicate that it existed prior to the interaction.
-
Communication – Messages or stimuli between instances are illustrated with arrows. A message or stimulus is drawn with its end on the lifeline of the instance that sends it and its arrowhead on the lifeline of the instance that receives it.
-
Activity – The time during which an instance is active (either executing an operation directly or through a subordinate operation) can be shown with activations.
-
Destruction – If an instance is destroyed during the interaction, its lifeline ends at the level of the message or stimulus that destroys it, and a destruction marker appears; otherwise, its lifeline extends beyond the final message or stimulus to indicate that it exists during the entire interaction.
Naming Conventions
A lifeline has the name of an object or classifier role. For details, see Objects or Classifier Roles.
Related Topics
Classifier Roles | Model Elements and Relationships in Sequence Diagrams | Messages | Objects | Stimuli