Terms and Concepts
An instance is a concrete manifestation of an abstraction to which a set of operations can be applied and which has a state that stores the effects of the operations. Instance and object are largely synonymous. Graphically, an instance specification is rendered by underlining its name.
The UML's class/object dichotomy is discussed in Chapter 2 . |
Associations are discussed in Chapters 5 and 10; links are discussed in Chapters 14 and 16 . |
Abstractions and Instances
Instances don't stand alone; they are almost always tied to an abstraction. Most instances you'll model with the UML will be instances of classes (and these things are called objects), although you can have instances of other things, such as components, nodes, use cases, and associations. In the UML, an instance is easily distinguishable from an abstraction. To indicate an instance, you underline its name.
Classifiers are discussed in Chapter 9 . |
Abstract classes are discussed in Chapter 9; interfaces are discussed in Chapter 11 . |
Object diagrams are discussed in Chapter 14 . |
Types
An instance has a type. The type of an actual instance must be a concrete classifier, but an instance specification (that does not represent a single instance) could have an abstract type. In notation, the name of the instance is followed by a colon followed by the type, for example, t : TRansaction.
Interaction diagrams are discussed in Chapter 19; activity diagrams are discussed in Chapter 20; dynamic typing is discussed in Chapter 11; classifiers are discussed in Chapter 9 . |
Figure 13-2. Named and Anonymous Instances

Names
An instance may have a name that distinguishes it from other instances within its context. Typically, an object lives within the context of an operation, a component, or a node. A name is a textual string, such as t and myCustomer in Figure 13-2. That name alone is known as a simple name. The abstraction of the instance may be a simple name (such as transaction) or it may be a path name (such as Multimedia::AudioStream) which is the abstraction's name prefixed by the name of the package in which that abstraction lives.
Operations are discussed in Chapters 4 and 9; components are discussed in Chapter 15; nodes are discussed in Chapter 27 . |
Roles and structured classes are discussed in Chapter 15 . |
Operations
Not only is an object something that usually takes up space in the real world, it is also something you can do things to. The operations you can perform on an object are declared in the object's abstraction. For example, if the class TRansaction defines the operation commit, then given the instance t : transaction, you can write expressions such as t.commit(). The execution of this expression means that t (the object) is operated on by commit (the operation). Depending on the inheritance lattice associated with TRansaction, this operation may or may not be invoked polymorphically.
Operations are discussed in Chapters 4 and 9; polymorphism is discussed in Chapter 9 . |
State
An object also has state, which in this sense encompasses all the properties of the object plus the current values of each of these properties (also including links and related objects, depending on your viewpoint). These properties include the attributes and associations of the object, as well as all its aggregate parts. An object's state is therefore dynamic. So when you visualize its state, you are really specifying the value of its state at a given moment in time and space. It's possible to show the changing state of an object by showing it multiple times in the same interaction diagram, but with each occurrence representing a different state.When you operate on an object, you typically change its state; when you query an object, you don't change its state. For example, when you make an airline reservation (represented by the object r : Reservation), you might set the value of one of its attributes (for example, price = 395.75). If you change your reservation, perhaps by adding a new leg to your itinerary, then its state might change (for example, price = 1024.86).
Attributes are discussed in Chapter 4; interaction diagrams are discussed in Chapter 19. Another way to show the changing state of an individual object over time is via state machines, which are discussed in Chapter 22 . |
Figure 13-3. Object State

Other Features
Processes and threads are an important element of a system's process view, so the UML provides a visual cue to distinguish elements that are active (those that are part of a process or thread and represent a root of a flow of control) from those that are passive. You can declare active classes that reify a process or thread, and in turn you can distinguish an instance of an active class, as in Figure 13-4.
Figure 13-4. Active Objects

Processes and threads are discussed in Chapter 23 . |
Interaction diagrams are discussed in Chapter 19 . |
Links are discussed in Chapters 14 and 16; static-scoped attributes and operations are discussed in Chapter 9 . |
Standard Elements
All of the UML's extensibility mechanisms apply to objects. Usually, however, you don't stereotype an instance directly, nor do you give it its own tagged values. Instead, an object's stereotype and tagged values derive from the stereotype and tagged values of its associated abstraction. For example, as shown in Figure 13-5, you can explicitly indicate an object's stereotype as well as its abstraction.
Figure 13-5. Stereotyped Objects

The UML's extensibility mechanisms are discussed in Chapter 6 . |