Object Diagram

Object diagram was defined in now obsolete UML 1.4.2 Specification as "a graph of instances, including objects and data values. A static object diagram is an instance of a class diagram; it shows a snapshot of the detailed state of a system at a point in time." It also stated that object diagram is "a class diagram with objects and no classes."

UML 2.4 specification simply provides no definition of object diagram except that "the following nodes and edges are typically drawn in an object diagram: Instance Specification and Link (i.e., Association)."

Note, that UML 2.5 standard hierarchy of diagrams (see UML 2.5 diagrams overview), shows class diagrams and object diagrams as completely unrelated. Some other authoritative UML sources state that component diagrams and deployment diagrams containing only instance specifications are also special kinds of object diagrams.

Object diagram overview below shows some major elements of object diagram - named and anonymous instance specifications for objects, slots with value specifications, and links (instances of association).

Object diagram overview - instance specifications, value specifications, slots, and links.

Object diagram overview - instance specifications, value specifications, slots, and links.


Object Diagram

An Object diagram is closely related to a Class diagram, with the distinction that it depicts object instances of Classes and their relationships at a point in time. Object diagrams do not reveal architectures varying from their corresponding Class diagrams, but reflect multiplicity and the roles instantiated Classes could serve. They are useful in understanding a complex Class diagram, by creating different cases in which the relationships and Classes are applied

This might appear similar to a Composite Structure diagram, which also models run-time behavior; the difference is that Object diagrams exemplify the static Class diagrams, whereas Composite Structure diagrams reflect run-time architectures different from their static counterparts. An Object diagram can also be a kind of Communication diagram (which also models the connections between objects, but additionally sequences events along each path).

You generate Object diagram elements and connectors from the Object pages of the Toolbox.

Example Diagram

This example shows a simple Class diagram, with two Class elements connected.

These Classes are instantiated as Objects in an Object diagram. There are two instances of Computer in this model, demonstrating the usefulness of Object diagrams in considering the relationships and interactions Classes might have in practice.