What is a Class?
The best way to think about this is to think about it in the real world. So let’s put this into context then. Consider a class as a description of a person, many people share the same sort of attributes and can carry out similar actions. (This part will be very stereotypical and will not intend to offend anyone).
How do you draw a Class?
The positive and negative signs depict whether the item is public or not this is called visibility, we are not going to go into this now. But it is something to keep in mind.
In the top cell of the class you can see the text objectName:className. This is the naming convention for drawing an object/class. Where the class name sits to to right of the objects name separated by a colon. So in a following example the class name would be Person and the Object would be a persons name. Who that person is?
An attribute is information stored in a class, this information is then used to create objects which act in the systems processes to produce an output.
A persons attributes may be such things as height, weight, skin colour, eye colour, hair colour, shoe size, etc.
As you can see from this list the attributes are things that “define” a person. In UML after you instantiate a class i.e. give its attributes values, you call it an Object.
This is a very basic drawing of a class, but it helps us visualise our problem. So if we take our person we can fill in our diagram. For arguments sake let’s call him Paul. We can now fill in some attributes for Paul.
Now because we actually gave Paul values to those attributes he became an object. A class only describes the data that an object can hold.
Now you’re probably asking what about the bottom part of the table what are the actions, or maybe you have figured it out. But let’s do this together, an action if you’ve guessed it or not is something that ‘Paul’ can do. Breathing I would imagine he could do, also the ability to walk and talk would get our ‘Paul’ far in this quest for knowledge.
So let’s populate our diagram
Admittedly Paul is not looking very interesting but you get the idea (I hope). You could give this a go, create your own person, and think about all the attributes and actions your person could do.
So that’s it basically. The only hard part about this part is finding the data you’re system needs to be functional and carry out task. When you have moved in to the development of a system changes to this can be drastic. A client may not think that adding functionality on during the development is a hard thing but it cause so many problems to this stage. It would be best if a customer made recommendations with a view to add them in at a later version of the software.