Chapter 8 Working with Object-Oriented Models


Class/interface operation checks

The following OOM model checks are made on class and interface operations:

Check Description and Correction
Operation name and code uniqueness Operation names and codes must be unique in the classifier.

Manual correction: Modify the duplicate name/code

Automatic correction: Appends a number to the duplicate name/code
Return type assignment The return type of an operation should be defined.

Manual correction: Assign a return type to the operation

Automatic correction: Assigns a void return type to the operation
Parameter data type assignment The data type of a parameter should be defined. Moreover, its type cannot be void.

Manual correction: Choose a valid data type for the parameter

Automatic correction: None
Abstract operation body [classes] Abstract operations in a class cannot be implemented.

Manual correction: Remove the body or the abstract property of the operation

Automatic correction: None
Abstract operation in a non-abstract class [classes] Abstract operations must be declared in abstract classes only.

Manual correction: Set the class to abstract, or remove the abstract property of the operation

Automatic correction: Removes the abstract property in the operation property sheet
Overloading operations signature [classes] Overloaded operations with the same name and same parameters data type cannot have different return types in a class.

Overloading an operation refers to using the same method name but performing different operations based on different parameter number or type.

Manual correction: Change the operation name, parameter data type, or return type

Automatic correction: None
Overriding operations [classes] When overriding a parent operation in a class, it is impossible to change its modifiers.

Overriding an operation means that an operation defined in a given class is redefined in a child class, in this case the operation of the parent class is said to be overriden.

Manual correction: Keep the same modifiers for child operation

Automatic correction: None
Enum: Constants must overload abstract method [classes] You can give each enum constant a different behavior by declaring an abstract method in the enum type and overloading it with a concrete method for each constant. In this case, each constant must overload the abstract method.

Manual correction: Make sure each constant is associated with a concrete method that overloads the abstract method.

Automatic correction: None

 


Copyright (C) 2008. Sybase Inc. All rights reserved.