18.6.  Class

The class is the dominant model element on a class diagram. In the UML metamodel it is a sub-class of Classifier and GeneralizableElement.

A class is represented on a class diagram as a rectangle with three compartments. The top compartment displays the class name (and stereotypes), the second compartment any attributes and the third any operations. These last two compartments may optionally be hidden.

18.6.1.  Class Details Tabs

The details tabs that are active for classes are as follows.

ToDoItem

Standard tab.

Properties

See Section 18.6.2, “ Class Property Toolbar and Section 18.6.3, “ Property Fields For Class below.

Documentation

Standard tab. See Section 13.4, “ Documentation Tab.

Presentation

Standard tab. The tick boxes, Attributes and Operations allow the attributes and operations compartments to be shown (the default) or hidden. This is a setting valid for only the current diagram that shows the class. The editable Bounds field defines the bounding box for the package on the diagram.

Source

Standard tab. This contains a template for the class declaration and declarations of associated classes.

Constraints

Standard tab. There are no standard constraints defined for Class within the UML metamodel.

Stereotypes

Standard tab.

Tagged Values

Standard tab. In the UML metamodel, Class has the following standard tagged values defined.

  • persistence (from the superclass, Classifier). Values transitory, indicating state is destroyed when an instance is destroyed or persistent, marking state is preserved when an instance is destroyed.

  • semantics (from the superclass, Classifier). The value is a specification of the semantics of the class.

  • derived (from the superclass, ModelElement). Values true, meaning the class is redundant -it can be formally derived from other elements, or false meaning it cannot.

    [Note]Note

    Derived classes still have their value in analysis to introduce useful names or concepts, and in design to avoid re-computation.

[Note]Note

The UML Element metaclass from which all other model elements are derived includes the tagged element documentation which is handled by the documentation tab under ArgoUML

Checklist

Standard tab for a Classifier.

18.6.2.  Class Property Toolbar

Go up

Navigate up through the package structure.

New attribute

This creates a new attribute (see Section 18.7, “ Attribute) within the class, navigating immediately to the properties tab for that attribute.

New operation

This creates a new operation (see Section 18.8, “ Operation) within the class, navigating immediately to the properties tab for that operation.

New reception

This creates a new reception, navigating immediately to the properties tab for that reception.

New inner class

This creates a new inner class (which appears on no diagram) within the class. This belongs to the class and is restricted to the namespace of the class. It exactly models the Java concept of inner class. As an inner class it needs no attributes or operations, since it shares those of its owner.

[Note]Note

Inner class is not a separate concept in UML. This is a convenient shorthand for creating a class that is restricted to the namespace of its owning class.

New class

This creates a new class (which appears on no diagram) within the same namespace as the current class.

New Stereotype

This creates a new Stereotype (see Section 16.6, “ Stereotype) for the selected class, navigating immediately to the properties tab for that stereotype.

Delete

This deletes the class from the model

[Warning]Warning

This is a deletion from the model not just the diagram. To delete a class from the diagram, but keep it within the model, use the main menu Remove From Diagram (or press the Delete key).

18.6.3.  Property Fields For Class

Name

Text box. The name of the class. The name of a class has a leading capital letter, with words separated by “bumpy caps”.

[Note]Note

The ArgoUML critics will complain about class names that do not have an initial capital.

Namespace

Drop down selector with navigation button. Records and allows setting of the namespace for the class. This is the package hierarchy.

Button 1 click on the entry will move the class to the selected namespace.

Modifiers

Check box, with entries Abstract, Leaf, Root, and Active.

  • Abstract is used to declare that this class cannot be instantiated, but must always be subclassed. The name of an abstract class is displayed in italics on the diagram.

    [Caution]Caution

    If a class has any abstract operations, then it should be declared abstract. ArgoUML will not enforce this.

  • Leaf indicates that this class cannot be further subclassed, while Root indicates it can have no superclass. It is possible for a class to be both Abstract and Leaf, since its static operations may still be referenced.

  • Active indicates that this class exhibits dynamic behavior (and is thus associated with a state or activity diagram).

Visibility

Radio box, with four entries public, private, protected, and package. Indicates whether the class is visible outside the namespace.

Client Dependencies

Text area. Lists the “depending” ends of the relationship, i.e. the end that makes use of the other end.

Button 1 double click navigates to the dependency and opens its property tab.

Button 2 click shows a pop-up menu with one entry Add... that opens a dialog box where you can add and remove depending modelelements.

Supplier Dependencies

Text area. Lists the “supplying” ends of the relationship, i.e. the end supplying what is needed by the other end.

Button 1 double click navigates to the dependency and opens its property tab.

Button 2 click shows a pop-up menu with one entry Add... that opens a dialog box where you can add and remove dependent modelelements.

Generalizations

Text area. Lists any class that generalizes this class.

Button 1 double click navigates to the generalization and opens its property tab.

Specializations

Text box. Lists any specialized class (i.e. for which this class is a generalization).

Button 1 double click navigates to the generalization and opens its property tab.

Attributes

Text area. Lists all the attributes (see Section 18.7, “ Attribute) defined for this class. Button 1 double click navigates to the selected attribute. Button 2 gives a pop up menu with two entries, which allow reordering the attributes.

  • Move Up. Only available where there are two or more attributes listed, and the attribute selected is not at the top. It moves the attribute up one position.

  • Move Down. Only available where there are two or more attributes listed, and the attribute selected is not at the bottom. It moves the attribute down one position.

Association Ends

Text box. Lists any association ends (see Section 18.12, “ Association) of associations connected to this class.

Button 1 double click navigates to the selected entry.

Operations

Text area. Lists all the operations (see Section 18.8, “ Operation) defined on this class. Button 1 click navigates to the selected operation. Button 2 gives a pop up menu with two entries, which allow reordering the operations.

  • Move Up. Only available where there are two or more operations listed, and the operation selected is not at the top. It moves the operation up one position.

  • Move Down. Only available where there are two or more operations listed, and the operation selected is not at the bottom. It moves the operation down one position.

Owned Elements

Text area. A listing of model elements contained within the classes' namespace. This is where any inner class (see Section 18.6.2, “ Class Property Toolbar) will appear

Button 1 double click on any of the model elements navigates to that model element.

[Tip]Tip

Most namespace hierarchies should be managed through the package mechanism. Namespace hierarchies through classes are best restricted to inner classes. Conceivable datatypes, signals and interfaces could also appear here, but actors and use cases would seem of no value.