Each object is represented by a rectangle, which contains either the name of the object, the name and the class of the object (separated by a colon), or only the object's class (in which case the object is said to be anonymous). The name by itself corresponds to an incomplete model, in which the object's class has not yet been specified. The class on its own avoids the introduction of unnecessary names into diagrams, while allowing the expression of general mechanisms that are valid for many objects. The diagram below illustrates the three representation possibilities.
The name of the class may contain the complete path built from the names of the various containing packages separated by double colons, as in this example:
The stereotype of the class may reappear in the object compartment, either using its textual form (between guillemets («») above the name of the object), its graphical form (in the top right corner), or using a particular graphical representation that replaces the object symbol. There is no object stereotype; the stereotype that appears within an object is always the stereotype of the class.
Rectangles that symbolize objects may also include a second compartment that contains the attribute values. The attribute type is already specified in the class, so it is not necessary to display it in representations of objects. The following diagram represents an anonymous object of class
, with a Car
attribute that has the value Color
:red
© 1997 Editions, Eyrolles, Paris, France . All rights reserved.