UML Guide v2.1
Author: Rajinder Yadav
Date: Oct 9, 2007
UML Object Element
A UML object is an instance of a UML class element, as such there is a 1-to-many relationship between the class and object elements. An object diagram represents a static view of the running state of a class diagram. Each object has a it's own set of unique identity and state. All objects of a given class share the same characteristics and behaviours. The UML diagram for an object looks like a class diagram, with the name part underlined. The following diagram show an unnames object and a named object of class Student.
| :Student |
-name="Jenny" -GPA=3.5 -Dept="Arts" |
+AttendClass() +DoHomework() +TakeExam() |
|
| Yadav:Student |
-name="Pushpa" -GPA=4.0 -Dept="Math" |
+AttendClass() +DoHomework() +TakeExam() |
|
Diagram 1 - Object Diagrams
The name of the object is separated from the name of the class it is a instance of. The identity of the object proceeds the name of the class and the two are separated by a ":" colon sign, as the object diagram above to the right shows. Like class diagrams, object diagrams may omit showing the state and behaviour sections. You will notice that the states of an object diagram have assigned runtime values which can be used to convey information in a collaboration diagram.
Object Diagram
The following diagram depicts a static model of an object collaboration diagram. A teacher is handing out lab assignments to students who are paired up to complete their lab assignments and hand them back to the teacher. The teacher object is associated with all student objects and there is a two way association that takes place. The diagram also shows that only student on the same team may send messages between each other and there is no interaction with other student objects from different teams.
 Diagram 2 - Object Interaction
Object Roles
When objects of the same class interact with each other, one can use "roles" to distinguish one type of object from another type. The following diagram shows how role labels and tagged values can be added to a diagram to provide more detail.
 Diagram 3 - Object Interaction With Roles
Copyright © 2007 Rajinder Yadav, All rights reserved
UML logo are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries
|