UML - Timing Diagram



In UML, timing diagrams are a type of interaction diagram that use different notations compared to sequence and collaboration diagrams. They feature a graph or waveform showing the state of a lifeline at a specific moment. These diagrams illustrate how conditions change within and between lifelines along a linear time axis.

A timing diagram shows how an object transitions from one form to another. A waveform displays the flow among software programs at various time points.

Key Points of Timing Diagram

Key points of a timing diagram include −

  • It focuses on the specific time when messages are sent between objects.
  • It details the time processing of an object.
  • It is used in distributed and embedded systems.
  • It shows how an object changes from throughout its lifeline.
  • Lifelines are named on the left, and the diagram is read from left to right.
  • It provides a graphical view of a lifeline's states over time.
  • In UML, timing diagrams have several notations to clarify state transitions between two lifelines over time.

Basic concepts of a Timing Diagram

In UML, the timing diagram constitutes several major elements, which are as follows −

Lifeline

A lifeline represents an individual element involved in the interaction. It signifies a single entity participating in the interaction and is labelled with the name of the classifier it represents. A lifeline may be placed within a "swim lane" or a diagram frame.

State or Condition Timeline

The timing diagram displays the state of a classifier or attributes that are involved, or certain testable conditions, which represent discrete values of the classifier.

In UML, these states or conditions are continuous, often used to represent factors like temperature or density, where entities experience a continuous state change.

Duration Constraint

A duration constraint refers to a specific time interval, determining whether the constraint is satisfied for a given duration. It inherits its semantics from constraints.

A negative trace indicates violated constraints, meaning the system has failed. A duration constraint is represented by a graphical link between the time interval and the element it constrains.

Time Constraint

A time constraint represents a time interval and indicates whether the constraint is satisfied or not. The constraint is associated with a time expression.

A negative trace indicates a violation, meaning the system has failed. The graphical link between the time interval and the element it constrains is depicted by a small line connecting them.

Destruction Occurrence

Destruction occurrence signifies a message indicating the destruction of an instance, defined by a lifeline. It may also result in the destruction of other objects related to the composition of the destroyed object. After the destruction event, nothing further happens on the given lifeline. It is represented by a cross at the end of a timeline.

Example of a Timing Diagram

A timing diagram example from the medical domain that shows different stages of Alzheimer's disease (AD) is given below.

Alzheimer's is a progressive and fatal brain disease that leads to memory loss and cognitive decline. The cause of the disease is still unknown, and it cannot be cured. It is one of the leading causes of death in the United States.

Doctors may use a diagnostic framework with three to seven stages, where the progression lasts for about 8 to 10 years. In some cases, it can last up to 20 years from the time the neurons begin changing.

The example below represents the timing for a seven-stage framework. The example is a UML diagram and is not intended to serve as a reference for medical research. The medical details are provided to help you better understand the UML diagram.

Seven-stage Alzheimer's Disease Framework

The seven stages of Alzheimer's disease are explained below −

1. No Impairment, Normal State

At this stage, memory and cognitive abilities appear normal.

2. Normal Aged Forgetfulness

This stage typically affects people around the age of 65, who report cognitive and functional difficulties, such as trouble recalling names and recent history from the past 5 to 10 years.

3. Early Confessional, Mild Cognitive Impairment

At this stage, there are problems with word retrieval, organizing, planning, misplacing objects, and forgetting new information, affecting the person's surroundings.

4. Late Confessional, Mild Alzheimer's

Here, a person forgets recent events and conversations but still remembers themselves and their family. They struggle with tasks that require steps, like cooking or driving. This stage lasts about two years.

5. Early Dementia, Moderate Alzheimer's

At this point, the person can no longer manage independently. They have difficulty recalling personal details and contact information. It lasts for around 1.5 years.

6. Middle Dementia, Moderately Severe Alzheimer's

The person loses awareness of current events and cannot remember past events. They need help with basic tasks like bathing and dressing. This stage lasts about 2.5 years.

7. Late or Severe Dementia, Failure to Thrive

The person's intellectual abilities are severely limited. They may communicate only in short words or cries, and their health deteriorates as their body systems shut down. This stage lasts 1 to 2.5 years.

Benefits of Timing Diagram

  • Displays the state of an object at specific moments in time.
  • Supports both forward and reverse engineering processes.
  • Tracks every change that occurs within the system.

Drawbacks of Timing Diagram

  • Can be challenging to manage and interpret.
Advertisements