2.2.2 Representing Arrays in UML Object Diagrams

Overview

An object diagram shows one array instance and the values at its indexed positions. An airline Flight object can hold a field that references a particular array of seat numbers. The diagram should distinguish the Flight object from the array object it refers to.

Flight flight = new Flight();
flight.SeatNumbers = new int[] { 12, 14, 16 };
Draw a Specific Array
Object diagram for representing arrays in uml object diagrams: draw a specific array.
Draw a Specific Array
  • New
  • Changed
  • Removed

The reference labeled SeatNumbers reaches one array. The array has entries [0], [1], and [2]. These labels identify positions, while 12, 14, and 16 are the stored values. Another Flight could reference a different array even if its values happen to match.

Keep the array in its own box instead of writing all its values directly in the Flight box. That separation makes the reference relationship and the indexed storage visible.

Trace the Outcome

Trace flight.SeatNumbers[2] from the Flight arrow to the array position. Draw a second Flight with its own array and explain why equal entries would not make the two arrays one object.