A class diagram can list fields beneath the class name.
For example:
Player
--------------------------------
name : string
jerseyNumber : int
isAvailable : bool
Each row names one field and identifies its type.
A common form is:
fieldName : Type
For:
jerseyNumber : int
read:
Player has a field named
jerseyNumberwhose type isint.
For:
isAvailable : bool
read:
Player has a Boolean field named
isAvailable.
Class diagram:
name : string
Object diagram:
name = "Jordan"
The class definition tells you what information Player objects can contain.
The object snapshot tells you the current value for one instance.
If a Player can refer to a Team:
team : Team
This field is different from:
teamName : string
The first can hold a Team object reference.
The second holds text.
That distinction helps represent object relationships directly.
A conceptual soccer class could be:
Player
--------------------------------
name : string
jerseyNumber : int
isAvailable : bool
team : Team
The types reflect the intended information:
Do not add fields simply because a real Player could have them.
Include the fields needed by the current software design.
Each field should have a clear purpose in the model.