17.5. Class

The class is the dominant artifact 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 horizontal compartments. The top compartment displays the class name (and stereotype), the second compartment any attributes and the third any operations. The last two compartments may optionally be hidden.

17.5.1. Class Details Tabs

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

ToDoItem

Standard tab.

Properties

See Section 17.5.2, “Class Property Toolbar” and Section 17.5.3, “Property Fields For Class” below.

Documentation

Standard tab. See Section 12.5, “Documentation Tab”.

Style

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 all diagrams that show the class. The 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.

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 artifacts are derived includes the tagged element documentation which is handled by the documentation tab under ArgoUML

17.5.2. Class Property Toolbar

Go up

Navigate up through the package structure.

Add attribute

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

Add operation

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

Add 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.

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).

17.5.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.

Stereotype

Drop down selector. Class is provided by default with the UML standard stereotypes for Class (implementationClass and type) and for Classifier (metaclass, powerType, process, thread and utility).

[Tip]Tip

One stereotype that is not part of the UML standard, but is widely used is Singleton, used to distinguish classes which have a single static instance, and no public constructor. Although not part of ArgoUML by default, this stereotype is understood by the critics. You may find it useful to create this stereotype for yourself (see Section 15.4, “Stereotype”).

Navigate Stereotype

icon. If a stereotype has been selected, this will navigate to the stereotype property panel (see Section 17.4, “Stereotype”).

Namespace

Drop down selector. 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 three entries public, protected and private. 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.

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.

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 17.6, “Attribute”) defined for this class. Button 1 double click navigates to the selected attribute.

Association Ends

Text box. Lists any association ends (see Section 17.11, “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 17.7, “Operation”) defined on this class. Button 1 click navigates to the selected operation.

Owned Elements

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

Button 1 double click on any of the artifacts navigates to that artifact.

[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.