Object diagram

Where a class diagram shows types, an object diagram shows actual instances with actual values. It is a snapshot, and it is unusually good at explaining a confusing structure by example.

Use it when a class diagram has left people unsure what the data actually looks like.


#When to draw one

  • Explaining a model by example rather than in the abstract.

  • Documenting a specific test scenario or fixture.

  • Teaching, where a concrete instance beats a general rule.


#What is on the diagram

Element

Meaning

Object

name : Type, underlined

Attribute values

Actual values, not types

Link

A line between objects, an instance of an association


#A worked example

One order, with its real values:

Object diagram

The source, which you can paste into a new diagram and edit:

@startuml
object "order42 : Order" as O {
  id = 4c1e-88fa
  status = AWAITING_PAYMENT
  total = 148.50
  placedAt = 2026-09-01T14:22Z
}
object "item1 : OrderItem" as I1 {
  sku = KB-104
  quantity = 1
  unitPrice = 129.00
}
object "item2 : OrderItem" as I2 {
  sku = CB-USB-2M
  quantity = 2
  unitPrice = 9.75
}
object "alice : Customer" as C {
  email = alice@example.com
  tier = STANDARD
}

C -- O : places
O *-- I1
O *-- I2
@enduml

#A few things that catch people out

  • Use real, plausible values. Foo and bar defeat the purpose of an object diagram.

  • It is a snapshot at one instant. Say which instant if it matters.

  • Pair it with the class diagram rather than replacing it.



Four types cover most of it.