Login | Register
My pages Projects Community openCollabNet

15.5.  Storage

Critics concerning attributes of classes.

The current version of ArgoUML has the following critics in this category.

15.5.1.  Revise Attribute Names to Avoid Conflict

This critic is discussed under an earlier design issues category (see Section 15.4.2, “ Revise Attribute Names to Avoid Conflict ).

15.5.2.  Add Instance Variables to a Class

Suggestion that no instance variables have been specified for the given class. Such classes may be created to specify static attributes and methods, but by convention should then be given the stereotype «utility».

15.5.3.  Add a Constructor to a Class

You have not yet defined a constructor for class class. Constructors initialize new instances such that their attributes have valid values. This class probably needs a constructor because not all of its attributes have initial values.

Defining good constructors is key to establishing class invariants, and class invariants are a powerful aid in writing solid code.

To fix this, add a constructor manually by clicking on class in the explorer and adding an operation using the context sensitive pop-up menu in the property tab, or select class where it appears on a class diagram and use the Add Operation tool.

In the UML 1.4 standard, a constructor is an operation with the stereotype «create». Although not strictly standard, ArgoUML will also accept «Create» as a stereotype for constructors.

By convention in Java and C++ a constructor has the same name as the class, is not static, and returns no value. ArgoUML will also accept any operation that follows these conventions as a constructor even if it is not stereotyped «create».

[Caution]Caution

Operators are created in ArgoUML with a default return parameter (named return). You will need to remove this parameter to meet the Java/C++ convention.

15.5.4.  Reduce Attributes on a Class

Suggestion that the class has too many attributes for a good design, and is at risk of becoming a design bottleneck.

The Wizard of this critic allows setting of the treshold, i.e. the maximum number of attributes allowed before this critic fires.

[Caution]Caution

This number is not stored persistently, and there is no way to reduce it after it has been set higher, except by creating more attributes until the critic fires again. Restarting ArgoUML resets this number to its default: 7.