SATC LOGO

Software Quality Metrics for Object-Oriented Environments

AUTHORS:
Dr. Linda H. Rosenberg Lawrence E. Hyatt
Unisys Government Systems Software Assurance Technology Center
Goddard Space Flight Center Goddard Space Flight Center
Bld 6 Code 300.1 Bld 6 Code 302
Greenbelt, MD 20771 USA Greenbelt, MD 20771 USA

I. INTRODUCTION

Object-oriented design and development are popular concepts in today's software development environment. They are often heralded as the silver bullet for solving software problems. While in reality there is no silver bullet, object-oriented development has proved its value for systems that must be maintained and modified. Object-oriented software development requires a different approach from more traditional functional decomposition and data flow development methods. This includes the software metrics used to evaluate object-oriented software.

The concepts of software metrics are well established, and many metrics relating to product quality have been developed and used. With object-oriented analysis and design methodologies gaining popularity, it is time to start investigating object-oriented metrics with respect to software quality. We are interested in the answer to the following questions:

II. METRIC EVALUATION CRITERIA

While metrics for the traditional functional decomposition and data analysis design approach measure the design structure and/or data structure independently, object-oriented metrics must be able to focus on the combination of function and data as an integrated object [1]. The evaluation of the utility of a metric as a quantitative measure of software quality was based on the measurement of a software quality attribute. The metrics selected, however, are useful in a wide range of models. The object-oriented metric criteria, therefore, are to be used to evaluate the following attributes:

Whether a metric is "traditional" or "new", it must be effective in measuring one or more of these attributes. As each metric is presented, we will briefly discuss its applicability.

The SATC's approach to identifying a set of object-oriented metrics was to focus on the primary, critical constructs of object-oriented design and to select metrics that apply to those areas. The suggested metrics are supported by most literature and some object-oriented tools. The metrics evaluate the object-oriented concepts: methods, classes, coupling, and inheritance. The metrics focus on internal object structure, external measures of the interactions among entities, measures of the efficiency of an algorithm and the use of machine resources, as well as psychological measures that affect the ability of a programmer to create, comprehend, modify, and maintain software.

We support the use of three traditional metrics and present six additional metrics specifically for object-oriented systems. The SATC has found that there is considerable disagreement in the field about software quality metrics for object-oriented systems [1,4]. Some researchers and practitioners contend traditional metrics are inappropriate for object-oriented systems. There are valid reasons for applying traditional metrics, however, if it can be done. The traditional metrics have been widely used, they are well understood by researchers and practitioners, and their relationships to software quality attributes have been validated [1,4,8,9] Preceding each metric, a brief description of the object-oriented structure is given. Each metric is then described, interpretation guidelines given, and the applicable quality attributes listed.

III. TRADITIONAL METRICS

A. Methods

In an object-oriented system, traditional metrics are generally applied to the methods that comprise the operations of a class. A method is a component of an object that operates on data in response to a message and is defined as part of the declaration of a class. Methods reflect how a problem is broken into segments and the capabilities other classes expect of a given class. Two traditional metrics are discussed here: cyclomatic complexity and size (line counts).

IV. OBJECT-ORIENTED SPECIFIC METRICS

As discussed, many different metrics have been proposed for object-oriented systems. The object-oriented metrics that were chosen by the SATC measure principle structures that, if improperly designed, negatively affect the design and code quality attributes.

The selected object-oriented metrics are primarily applied to the concepts of classes, coupling, and inheritance. For some of the object-oriented metrics discussed here, multiple definitions are given, since researchers and practitioners have not reached a common definition or counting methodology. In some cases, the counting method for a metric is determined by the software analysis package being used to collect the metrics.

A. Class

A class is a template from which objects can be created. This set of objects share a common structure and a common behavior manifested by the set of methods. Three class metrics described here measure the complexity of a class using the class's methods, messages and cohesion.

A.1 Method

A method is an operation upon an object and is defined in the class declaration.

A.2 Message

A message is a request that an object makes of another object to perform an operation. The operation executed as a result of receiving a message is called a method. The next metric looks at methods and messages within a class.

A.3 Cohesion

Cohesion is the degree to which methods within a class are related to one another and work together to provide well-bounded behavior. Effective object-oriented designs maximize cohesion since it promotes encapsulation. The third class metrics investigates cohesion.

A.4 Coupling

Coupling is a measure of the strength of association established by a connection from one entity to another. Classes (objects) are coupled three ways:

  1. When a message is passed between objects, the objects are said to be coupled.
  2. Classes are coupled when methods declared in one class use methods or attributes of the other classes.
  3. Inheritance introduces significant tight coupling between superclasses and their subclasses.

Since good object-oriented design requires a balance between coupling and inheritance, coupling measures focus on non-inheritance coupling. The next object-oriented metric measures coupling strength.

B. Inheritance

Another design abstraction in object-oriented systems is the use of inheritance. Inheritance is a type of relationship among classes that enables programmers to reuse previously defined objects including variables and operators. Inheritance decreases complexity by reducing the number of operations and operators, but this abstraction of objects can make maintenance and design difficult. The two metrics used to measure the amount of inheritance are the depth and breadth of the inheritance hierarchy.

V. SUMMARY

Product Quality for code and design has five attributes. These are Efficiency, Complexity, Understandability, Reusability, and Testability/Maintainability. The SATC has proposed nine metrics for object-oriented systems. They cover the key concepts for object-oriented designs: methods, classes (cohesion), coupling, and inheritance. For each metric, threshold values can be adopted, depending on the applicable quality attributes and the application objectives. Future work will be to define criteria for the metrics. That is, acceptable ranges for each metric will have to developed, based on the effect of the metric on desirable software qualities.

REFERENCES

  1. Chidamber, Shyam and Kemerer, Chris, "A Metrics Suite for Object-Oriented Design", IEEE Transactions on Software Engineering, June, 1994, pp. 476-492.
  2. Hudli, R., Hoskins, C., Hudli, A., "Software Metrics for Object-oriented Designs", IEEE, 1994.
  3. Lee, Y., Liang, B., Wang, F., "Some Complexity Metrics for Object-Oriented Programs Based on Information Flow", Proceedings: CompEuro, March, 1993, pp. 302-310.
  4. Lorenz, Mark and Kidd, Jeff, Object-Oriented Software Metrics, Prentice Hall Publishing, 1994.
  5. McCabe & Associates, McCabe Object-Oriented Tool User's Instructions, 1994.
  6. Set Laboratories, UX Metrics, 1994.
  7. Sharble, Robert, and Cohen, Samuel, "The Object-Oriented Brewery: A Comparison of Two Object-Oriented Development Methods", Software Engineering Notes, Vol 18, No 2., April 1993, pp 60 -73.
  8. Tegarden, D., Sheetz, S., Monarchi, D., "Effectiveness of Traditional Software Metrics for Object-Oriented Systems", Proceedings: 25th Hawaii International Conference on System Sciences, January, 1992, pp. 359-368.
  9. Williams, John D., "Metrics for Object-Oriented Projects", Proceedings: Object Expo Euro Conference, July, 1993, pp. 13-18.

Software Quality Metrics for Object-Oriented Environments was published in Crosstalk Journal, April 1997.