An object diagram is a structural diagram that shows a snapshot of the objects in a system and their relationships at a particular point in time. It provides a graphical representation of the instances of classes in a system and the relationships between them.
Typical elements:
-
Objects: An object represents an instance of a class in a system. Objects are shown as rectangles with the name of the object at the top.
-
Classes: A class represents a blueprint or a template for creating objects in a system. Classes are shown as rectangles with the name of the class at the top.
-
Relationships: Relationships represent the connections between objects in a system. The most common relationships in an object diagram are association, aggregation, and composition.
-
Association: An association represents a relationship between two objects in which one object uses or relies on the other object. It is represented by a line connecting the two objects.
-
Aggregation: Aggregation represents a "has-a" relationship between two objects in which one object is composed of or contains the other object. It is represented by a diamond-shaped arrowhead.
-
Composition: Composition represents a strong "has-a" relationship between two objects in which one object owns or controls the other object. It is represented by a filled diamond-shaped arrowhead.