A Metrics Suite for Object Oriented Design

Author(s): Shyam Chidamber and Chris F. Kemerer
Venue: Software Engineering, IEEE Transactions on, vol. 20
Date: unknown

Type of Experiement: Case Study
Sample Size: 1994

Quality
3

Summary:

In this paper Chidamber and Kemerer create a suite of six Object Oriented metrics based off of a theoretical base for evaluating object oriented programs. The authors then use Weyuker's proposed set of measurement principles to evaluate them. Finally the authors created a tool to automatically gather empirical data to demonstrate their feasibility. The metrics created by the authors are aimed at measuring the complexity of the design of the classes, therefore no dynamic behavior can be monitored. The benefit of this approach however is that these metrics can be gathered much earlier in the development life cycle and therefore have much more significant results and more time to act upon them. Below are the empirical results of each of the six metrics in the metric suite.

1. Weighted Methods per Class (WMC)
- WMC is the sum of the complexity of all methods defined in a class
- Complexity is not defined here to allow for general use of this algorithm
- Theoretical Basis
- Relates to Bunge's definition of complexity
- Number of methods along with complexity of methods is a good tell of how complex the system will be to maintain.
- Empirical Evaluation
- Showed that across languages and sizes of projects, the distribution of WMC is similar.
- Found that the larger classes are more likely to be inherited and have children, showing that extra attention should be given to these classes.

2. Depth of Inheritance Tree (DIT)
- DIT is maximum length from a node to the root of the tree.
- Theoretical Basis
- Relates to Bunge's notion of the scope of properties.
- The deeper a class is in the tree, the greater the number of methods it is likely to inherit making it more complex and unpredictable.
- Empirical Evaluation
- Both sites showed a top heavy DIT, showing that not enough reuse of code was taken advantage of
- But also shows that the farther down in the tree the nodes are the more methods are available to inherit, making the design easier but the testing much more difficult.

3. Number of Children (NOC)
- Number of immediate subclasses under a class
- Theoretical Basis
- Relates to scope of properties
-Empirical
- Showed in both sites that more work should have gone into designing classes to take advantage of similar commands.

4. Coupling Between Object Classes (CBO)
- Number of classes in which a class is coupled
- Theoretical Basis
- Excessive coupling limits reuse and the modular design of OO programming
- Empirical Evaluation
- Found that the highest NOC value was also the highest CBO value showing that more work might need to go into reevaluating one of these metrics.

5. Response For a Class (RFC)
- Absolute value of the Response Set
- Theoretical Basis
- If a large number of methods can be invoked in response to a message, then it is more complex and harder to test
- Empirical Evaluation
- Small number of classes are responsible for the majority of methods that execute in the application. Therefore more work should go into testing and debugging them.

6. Lack of Cohesion in Methods (LCOM)
- Number of null intersections or number of nonempty intersections
- Theoretical Basis
- Cohesion is desirable because it helps with encapsulation
- Empirical Evaluation
- A high LCOM value shows that there is low cohesion, and therefore finds classes that are attempting to perform multiple objectives.

0