Object diagram
Object diagrams are derived from class diagrams so object diagrams are dependent upon class diagrams.
Object diagrams represent an instance of a class diagram. The basic concepts are similar for class diagrams and object diagrams. Object diagrams also represent the static view of a system but this static view is a snapshot of the system at a particular moment.
Object diagrams are used to render a set of objects and their relationships as an instance.
Objectives of Object diagram
The objective of a diagram should be understood clearly to implement it practically. The purposes of object diagrams are similar to class diagrams.
The difference is that a class diagram represents an abstract model consisting of classes and their relationships. However, an object diagram represents an instance at a particular moment, which is concrete in nature.
It means the object diagram is closer to the actual system behavior. The purpose is to capture the static view of a system at a particular moment.
The objectives of the object diagram can be summarized as −
Forward and reverse engineering
Object relationships of a system
Static view of an interaction
Understand object behaviour and their relationship from practical perspective
An Example
An object diagram focuses on the attributes of a set of objects and how those objects relate to each other. For instance, in this object diagram below, all three bank accounts tie back to the bank itself. The class titles show the type of accounts (savings, checking, and credit card) that a given customer could have with this particular bank. The class attributes are different for each account type. For example, the credit card object has a credit limit, while the savings and checking accounts have interest rates.
Figure 1: An example of object diagram
Object diagram elements
Object diagrams are simple to create: they’re made from objects, represented by rectangles, linked together with lines. Take a look at the major elements of an object diagram.
Objects
Objects are instances of a class. For example, if “Savings” is a class, Account1 is an object of a class.
Class titles
Class titles are the specific attributes of a given class. In the above diagram, class titles of “Credit Card” class include the balance, identity, and credit limit of the account holders.