OOPortal OOPortal


Object Diagrams  «Prev  Next»
Lesson 2The object diagram
ObjectiveDefine the Purpose and Function of the Object Diagram.

UML Object Diagram

The object diagram is primarily an analysis and testing tool. It is used to understand a problem by documenting examples from the problem domain in a format compatible with the object model. The object diagram is also used during and after the construction of the class diagram to verify its accuracy.

Modeling objects

The object diagram models objects, or unique entities, whereas the class diagram models classes, or abstractions of real objects. Objects are real things like you and me, the computer you are working on right now, or the chair in which you are sitting. Classes are abstractions, concepts that describe people, computers, and chairs in general terms that allow us to work with the concepts without naming specific objects.

Abstractions

To come up with an abstraction, you must have real things on which to base it. The qualities of each real object are compared to identify common properties that support a common abstraction. If an object is encountered that does not fit the abstract, either the current abstract must change or a new abstraction must be created to support the new information.

Sources for Object diagrams

At the beginning of the course, you started with a problem domain that you described using the use case view. Use cases described interactions between the actors and the system. From those use cases you found scenarios. Now scenarios become your source for test cases to verify every behavior that your system needs to support. They are also the source for your object diagrams. In the next lesson, you will compare and contrast the object diagram and the class diagram notation.

Theory behind Object Diagrams

Object diagrams are derived from class diagrams. Therefore, 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.
Object diagrams shows the snapshot of the objects in a system at a point in time. Since it shows instances of classes, rather than the classes themselves, it is often called as an instance diagram. The objects are drawn using rounded rectangles.
Bank object diagram showing the objects in the system 1) Savings, 2) Checking, 3) Credit Card

An object diagram may undergo continuous change as execution proceeds. For example, links may get formed between objects and get broken. Objects may get created and destroyed, and so on. Object diagrams are useful to explain the working of a system.