Object Diagrams
Object diagrams model instances of classes. This type of diagram is used
to describe the system at a particular point in time. Using this technique, you
can validating the class diagram and it's multiplicity rules with real-world
data, and record test scenarios. From a notation standpoint, Object diagrams
borrow elements from Class diagrams.
Notation
Often, object diagrams use simpler notation than their class diagram
counterparts, to focus on the instances of objects and not the relationships
between classes (including inheritance). Many Object diagrams are diagrammed
using only Objects and Associations.
| Object |
Objects are identified by placing the instance name followed by a colon (:) in
front of the class name. Property values are written as "name=value" pairs. The
icon for an object is a rectangle divided into sections. |
 |
| Association |
Object diagrams can contain associations as well. Often, the constaints,
relationship details, and multiplicity rules found in the Class diagram are
left out to concentrate the diagram on the Objects and their properties.
Associations between Objects are simply diagrammed using a line joining the
two.
|
 |
In the section on Class diagrams
, we considered the classes in a veterinary system. Here, we'll use instances
of those classes in an object diagram. We'll consider the case of John, a pet
lover from Boston, MA and client of the veterinary hospital. He has two pets,
Rover, a dog, and Tweety, a bird.

Notice how considering a business example, in this case an owner with multiple
pets, can be used to test the multiplicity of the relationships we set up in
the class diagram.
|