Classes are the most important building blocks of UML. In fact classes are at the core of any object oriented system. . A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics. Now let us see how these are modeled in UML.
. A class is represented in UML by a rectangle with three components
Class : The first compartment in the UML diagram contains the Class name, Which UML recommends is centered and in bold.
Attributes : UML recommends the name of attribute are left justified and in plain type
Operations () : UML recommends the name of operations are left justified and in plain type
· Every class must have a name that distinguishes it from other classes. The class name is a textual string written with the first letter in upper case.
· A class may be drawn showing only its name.
· Abstract class names are shown in italics or by using braces.
When representing a class you can choose to show
Attributes , but not operations
Operations but not attributes
Attributes and operations
Or if you don’t want to show any of a class’s attributes or operations , You can simply represent it with a plain rectangle
The following is standard UML convention for naming classes
Class name should be
Start with an uppercase letter
Although not a UML recommendation, if you need give a class name with more than one word you should capitalize the initial letter of each word.
There is no strict UML convention for naming attributes and operations. But in common practice , the initial letter of the attributes and operations should not be capitalized . But initial letter of each word should be capitalized.
|owner : String
Class diagrams also display relationships such as containment, inheritance, associations and others.