A class diagram can list fields beneath the class name.
For example:
Player
--------------------------------
name : string
jerseyNumber : int
isAvailable : boolEach row names one field and identifies its type.
A common form is:
fieldName : TypeFor:
jerseyNumber : intread:
For:
isAvailable : boolread:
Class diagram:
name : stringObject 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 : TeamThis field is different from:
teamName : stringThe 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 : TeamThe 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.