In a computerized model, it is useful to know three different things about an object:
These ideas may look similar at first, but they answer different questions.
Suppose the Wildcats have two players:
Inside a model, we need a way to distinguish those specific objects.
We might identify them as:
player1player2Those are object identities used in the model.
The identity tells us which particular object we are talking about.
Even if two players happened to have the same name, they would still need to be represented as different objects if they are different people.
Both player1 and player2 represent players.
Their type can therefore be described as:
Player
A compact object-model notation can combine identity and type:
player1 : Player
Read this as:
“player1 is an object whose type is Player.”
Another object might be:
team1 : Team
or:
match1 : Match
The words before and after the colon have different jobs.
Before the colon: the specific object's identity.
After the colon: the object's type.
Now add selected field values.
For example:
player1 : Player| Field | Value |
|---|---|
| name | Jordan |
| jerseyNumber | 7 |
| position | Forward |
| isAvailable | true |
The identity is player1.
The type is Player.
The fields are name, jerseyNumber, position, and isAvailable.
The values are "Jordan", 7, "Forward", and true.
This is a snapshot of one object at a particular point in time.
Consider:
player1 : Playerplayer2 : PlayerThe two objects have the same type:
Player
But they are different objects because they have different identities:
player1
and
player2
A type describes a category or blueprint-like kind of thing.
An object represents one specific instance of that type.
Imagine two objects:
player3 : Playerplayer4 : PlayerTheir displayed values happen to match.
That does not automatically mean they are the same object.
The model still identifies them separately as player3 and player4.
This distinction matters whenever a computerized system must track individual things independently.
Same values and same identity are not the same idea.
Suppose Jordan becomes unavailable.
Before:
player1 : PlayerAfter:
player1 : PlayerThe identity remains:
player1
The type remains:
Player
One value changed.
The object represents the same player in a different state.
This is why object models are often described as snapshots. They can show what is true about specific objects at a particular moment.
A UML object diagram is a formal way to show specific object instances and selected information about them.
An object is commonly shown as a rectangle with a header containing its identity and type, followed by the field values that matter in the diagram.
Conceptually, one object could look like this:
player1 : Player
-------------------------
name = "Jordan"
jerseyNumber = 7
isAvailable = true
In formal UML presentation, the object header is visually distinguished according to UML notation. Later activities will show you how to read and create that notation in the diagramming tool.
For now, focus on the meaning:
player1 identifies the object;Player identifies its type;An object diagram is still a model.
It does not need to display every possible piece of information about the object.
If the purpose is to understand Saturday's lineup, the diagram might show:
It might leave out information that does not contribute to that purpose.
Abstraction still applies.
UML gives the model a consistent notation, but UML does not remove the need to decide what information belongs in the model.
A small soccer snapshot might include:
player1 : Player
-------------------------
name = "Jordan"
isAvailable = true
player2 : Player
-------------------------
name = "Casey"
isAvailable = true
team1 : Team
-------------------------
name = "Wildcats"
match1 : Match
-------------------------
opponent = "Rangers"
location = "North Field"
Each box represents one specific object.
Together, the objects begin to describe the state of the soccer system.
One important piece is still missing: how those objects are connected.
That is the role of object relationships.
When you encounter an object in a model, ask:
Which specific object is this?
That is its identity.
What kind of object is it?
That is its type.
What information does it currently contain?
Those are its selected field values.
Those three ideas are the foundation for reading UML object diagrams.