An object diagram is a snapshot: it shows specific objects that exist at one moment, the values in their fields, and the links between them. Where a class diagram says what can exist, an object diagram says what exists right now. Developers, testers and analysts read it to check a class model against a concrete case.
Every object diagram is an instance of some class diagram. Each box is one object, written name : Type and underlined. Instead of attribute types, the box lists slots with actual values. Lines between objects are links: one concrete instance of an association declared in the class diagram.
Because the values are real, an object diagram is the quickest way to test whether a class model makes sense. If you cannot draw a believable snapshot of your model, the model is probably wrong. Object diagrams are also a good way to explain a data structure, a test fixture, or the state of memory just before a bug.
Four symbols cover almost everything. The object box has its name underlined to distinguish it from a class. You may drop the name and keep only : Type (an anonymous object) when the identity does not matter. Slots show attribute = value; you only list the slots relevant to the point you are making. A link is a plain line; multiplicities are not shown because each link is exactly one connection.
Walkthrough: customer alice placed order42. The order owns two line items, each pointing at a product: two mugs and one T-shirt. Payment pay9 covers the order. Reading the slots lets you check the arithmetic: 2 × 19.95 + 20.00 = 59.90, which matches both the order total and the payment amount. That is exactly the kind of invariant an object diagram makes visible and a class diagram cannot.
Walkthrough: member bob has two loans, each tied to a physical copy. Loan l2 is highlighted because it is overdue. A business rule says a member may not borrow while at the loan limit or while anything is overdue. The snapshot turns that rule into a concrete test case: given this state, a third checkout must fail. Many teams draw such snapshots straight into test fixtures.
PlantUML supports objects directly with the object keyword. Paste this into the PlantUML server or an IDE plugin to render the shop example:
@startuml
object "alice : Customer" as alice {
id = 1017
email = "alice@ex.com"
}
object "order42 : Order" as order42 {
status = PAID
total = 59.90
}
object "li1 : LineItem" as li1 {
qty = 2
}
object "li2 : LineItem" as li2 {
qty = 1
}
object "mug : Product" as mug
object "tee : Product" as tee
alice -- order42 : placed
order42 -- li1
order42 -- li2
li1 -- mug
li2 -- tee
@endumlMermaid has no object diagram type; the usual workaround is a classDiagram with instance names as class names, which loses the underline convention.