Classes are modeled using a single rectangular shape with three internal compartments: the name, attribute, and operation.
Name Compartment
The name compartment holds the class name, an optional stereotype, and optional properties.
The name is located in the center of the compartment. The stereotype (<< >>) may be used to limit the role of the class in the model, and is placed at the top of the compartment. Common examples of class stereotypes include <<Factory>>, based on the Factory design pattern, and <<Interface>>, for Java interfaces or for user interfaces.
Properties use the constraint notation and are placed in the bottom-right corner of the compartment. Properties are basically constraints, used to clarify intent in defining the model element. Properties can be used to document the status of a class under development or for designations such as 'abstract' and 'concrete.'
Name compartment
Attribute compartment
The attribute compartment simply lists the attributes of the class using the notation you learned previously. The list order does not matter.
Attribute compartment
Operation compartment
Likewise, operations are simply listed in the operation compartment using the notation you learned in the previous lesson. The list order does not matter.
Operation compartment
The completed class definition can be shown as either the entire class definition with all three compartments visible or as
just the name compartment.