Contents > C: List of Design Rules > C.5 Operation Rules

C.5 Operation Rules

Rule: UnnamedCategory: Completeness
Severity: 1-highApplies to: all areas
Operation has no name.

Rule: CapitalizedCategory: Naming
Severity: 3-lowApplies to: all areas
Operation names should start with a lower case letter. This is a recommended style guideline in the UML standards [OMG03], [OMG05].

In many programming languages, constructors have the same name as their class, thus starting with upper case letters. Therefore, operations with the same name as their class are not reported.


Rule: KeywordCategory: Naming
Severity: 2-medApplies to: design
Operation name is a Java or C++ keyword.

Using programming language keywords as operation names will cause problems during code generation. Find another name for the operation.


Rule: AbstractOpCategory: Correctness
Severity: 1-highApplies to: all areas
Operation is abstract, but its owner class is not abstract.

In many programming languages, a class is abstract if at least one of its operations is abstract. Either make the owner class abstract, or provide an implementation for the operation.


Rule: LongParListCategory: Style
Severity: 2-medApplies to: all areas
The operation has a long parameter list with five or more parameters.

Long parameter lists are difficult to use, and likely to change more frequently. Change the design to pass one or more objects to the operation that encapsulate the required parameters. Note: the rule only considers in, out, and inout parameters; the return parameter (if any) is not counted.

  • Suggested in [Fow99].
  • Value returned: the number of parameters of the operation.


Rule: MulReturnCategory: Correctness
Severity: 1-highApplies to: all areas
The operation has more than one return parameter.

Many programming languages only support one return parameter per operation. Change some return parameters to out or inout parameters, or return one object that encapsulates all return parameters.

  • This is a WFR of the UML2.
  • Value returned: number of return parameters of the operation.


Rule: DupNameCategory: Naming
Severity: 1-highApplies to: all areas
The operation has two or more parameters with identical names.

Parameters must have unique names to distinguish them. This is a WFR of the UML.

  • Value returned: the name of the duplicate parameters.


Rule: QueryCategory: Style
Severity: 2-medApplies to: all areas
The operation name indicates a query, but it is not marked as a query.

The operation name suggests this is a getter (see Getters). Mark the operation as query to indicate that it does not change the owner's state.