Class modelling with UML¶
![]()
Features of a Class¶
There are 3 things you may define for a class:
- Name (Mandatory)
- Attributes (Optional)
- Methods (Optional)
In an application you can use classes as atomic code structures that exist as a separate block of code. In some classes you could use all three aspects of the class, but in others, you may only need Name and Attributes or Name and Methods.
At the design stage, you should define your classes, and UML is ideal for doing that. Here is a class GAME that shows how the model is used. As well as modelling the class graphically, a brief explanation of the class adds significant value.
Graphic¶

The class shown is called Game. It has 4 attributes that hold data being processed. It has 2 methods that can be called to process the data being held in an instance of the class. The value of doing this will be in the creation of code that is more robust and easier to use.