An object diagram is a snapshot of system objects at some point in time. Because it shows instances, not classes, an object diagram is often called an instance diagram.
It is used to document data structures and create static snapshots of the state of objects, taking into account real instances or prototypes.
The dynamics of the behavior of objects is usually depicted as a sequence of such diagrams.
1. Basic elements
An object is an instance of a class.
An object, like a class, is indicated by a rectangle, but its name is underlined. Name is the name of the object and the name of its class, separated by a colon. To indicate the values of the attributes of an object, a special section may be provided in its designation.
An object can be anonymous: this is necessary if at the moment it does not matter which object of this class takes part in the interaction.
Relations between objects:
Object declaration is done using the keyword object:
To declare Object attributes (fields) the colon symbol : should be used followed by Attribute name:
Also, it is possible to put all fields inside curl brackets
Relations between objects are determined using the following symbols:
It is possible to replace
.. to get a dashed line.
Also you can add a description to the link using a colon
: followed by the description text. You can use double quotation marks
"" on each side of the link to determine the number of elements.
Knowing these rules, you can create the following diagrams.
Object01 <|– Object02
Object03 *– Object04
Object05 o– “4” Object06
Object07 .. Object08 : some labels
You can use packages to group objects. It can be defined using the
package keyword, with the possibility to declare its background color using the html color code or its name.