What is an object diagram in UML?
A UML object diagram represents a specific instance of a class diagram at a certain moment in time. When represented visually, you'll see many similarities to the class diagram.
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. To take a closer look at this document, click here.
Object diagrams are not limited to banking use cases, however, as you can easily make an object diagram for family trees, corporate departments, or any other system with interrelated parts.
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 are instances of a class. For example, if "car" is a class, a 2007 Nissan Altima is an object of a class.
Class titles are the specific attributes of a given class. In the family tree object diagram, class titles include the name, gender, and age of the family members. You can list class titles as items on the object or even in the properties of the object itself (such as color).
Class attributes are represented by a rectangle with two tabs that indicates a software element.
Links are the lines that connect two shapes of an object diagram to each other. The corporate object diagram below shows how departments are connected in the traditional organizational chart style.
Object diagram applications
A developer will find object diagrams useful in many instances. These include:
Examining a specific iteration of a general system.
Getting a high-level overview of the system you will develop.
Testing a class diagram you’ve created for the overall structure of the system, using object diagrams for specific use cases.
Other UML object diagram examples
UML specifications typically don't change when you describe an object diagram in different programming languages. The whole purpose of UML is for developers to plan out software independent of specific platforms. Below are two of the most commonly used types of object diagrams in different programming languages.
Objective C object diagram
Objective C has become very popular since Apple's release of "Objective C 2.0," and now it's the programming language of choice for Apple marketplace applications. Most people who use Objective C object diagrams are attempting to show instances for an iPhone app.
Java object diagram
There are object diagrams that can be used in UML to describe instances that would ultimately be programmed in Java, and there are diagrams that describe Java objects that have nothing to do with UML. Whether you are looking for the former or the latter, Lucidchart can help you map the structure you need to create. Try it out for yourself.