A UML class diagram describes the structural design of software types.
An object diagram answers:
Which specific objects exist right now?
A class diagram answers:
Which kinds of objects can exist, and what structure do they have?
For a soccer system, a class diagram might contain:
Player
Team
Match
These are types, not current instances.
A simple class can be represented as:
+----------------------+
| Player |
+----------------------+
| name |
| jerseyNumber |
| isAvailable |
+----------------------+
The top compartment identifies the class.
The next compartment can list fields/attributes.
Methods are added later in PC1.
A class diagram might show:
jerseyNumber
An object diagram might show:
jerseyNumber = 7
The class diagram describes structure shared by Player objects.
The object diagram shows the current state of one specific Player instance.
If Player objects can refer to Team objects, the class model can show a structural relationship between:
Player
and:
Team
At this stage, focus on recognizing that the two types are related.
More detailed relationship notation is not needed to learn the basic class model.
A class diagram can guide C# questions such as:
The diagram is a design representation.
The C# class definition is the implementation representation.
Do not add:
Model only the structure required by the current purpose.
A simple accurate class diagram is more useful than a complicated diagram containing future concepts.