Object Oriented Metrics

»  Kenneth L. Morris

Candidate Metrics for Productivity Measurement:

Methods per Class:
From the standpoint of code reuse ... a large number of methods per object class is desirable because subclasses tend to inherit a larger number of methods from superclasses.

It was seem that extensibility will suffer if the number of methods per object class gets too large.

A larger number of methods per object class is likely to complicate testing due to the increased object size and complexity.

                                           Total No. of Methods
 Average No. of Methods per Object Class = --------------------------
                                          Total No. of Object Classes

also defined: Maximum No. and Minimum No. of Methods per Object Class
Inheritance Denpendencies:
Inheritance tree depth is likely to be more favorable than breadth in terms of reusability via inheritance. Deeper inheritance trees would seem to promote greater method sharing than would broad trees.

A deep inheritance tree may be more difficult to test than a broad one.

Comprehensibility may also be diminished with a large number inheritance layers.


Inheritance Tree Depth = max{Inheritance Tree Path Length} 

Degree of Coupling Between Objects:
A higher degree of coupling between objects is likely to complicate application maintenance because object interconnections and interactions are more complex.

The higher the degree of object independence (i.e. the more 'uncoupled' objects are from each other) the more likely it is that objects will suitable for reuse within the same applications and within other applications.

Uncoupled objects should be easier to augment than those with a high degree of 'uses' dependencies, due to the lower degree of interaction.

Testability is likely to degrade with a more highly coupled system of objects.

Object interaction complexity associated with coupling can lead to increased error generation during development.

                                              Total No. of Arcs
Average No. of Uses Dependencies per Object = -------------------
                                             Total No. of Objects

Arcs - in an Object Uses Network

        Maximum No. = max{No. of Uses Arcs}

Arcs - attached to any single object in a uses network
Degree of Cohesion of Objects:
Objects which are less dependent on other objects for data are likely to be more reusable.

Low cohesion is likely to produce a higher degree of errors in the development process. Low cohesion adds complexity which can translate into a reduction in application reliability.

                                Total Fan-in for All Objects
Degree of Cohesion of Objects = ----------------------------
                                   Total No. of Objects 

Object Library Effectiveness:
If objects are actually being designed to be reusable beyond a single application, then the effects should appear in object library usage statistics.

Average Number of Times a Library Object is Reused:

                    Total Number of Object Reuses
   Average Number = -----------------------------
                    Total Number of Library Objects 

 
also defined: Percent of Library Objects in an Application
Factoring Effectiveness:
As noted above, the more highly factored an apllication is, the smaller the number of implementation locations for the average method.

The more highly factored an inheritance hierarchy is the greater degree to which method reuse is likely to occur.

Highly factored applications are likely to be more reliable for reasons similar to those which argue that such applications are more maintainable. The smaller the number of implementation locations for the average task, the less likely that errors were made during coding

                          Number of Unique Methods
Factoring Effectiveness = ------------------------
                          Total Number of Methods

Degree of Reuse of Inheritance Methods:
Simply defining methods in such a way that they can be reused via inheritance does not guarantee that those methods are actually reused.

Percent of Potential Method Uses Actually Reused (PP):

             Total Number of Actual Method Uses
       PP = ------------------------------------ x 100
           Total Number of Potential Method Uses

Percent of Potential Method Uses Overridden (PM):

            Total Number of Methods Overridden
       PM = ------------------------------------- x 100
            Total Number of Potential Method Uses 

Average Method Complexity:
More complex methods are likely to be more difficult to maintain.

Greater method complexity is likely to lead to a lower degree of overall application comprehensibility.

Greater method complexity is likely to adversely affect application reliability.

More complex methods are likely to be more difficult to test.

                              Sum of the V(G) of all Methods
 Average Method Complexity =  ----------------------------------
                             Total Number of Application Methods

V(G)=e-n+2 (McCabe measure)
Application Granularity:
One of the goals of object-oriented design is finer granularity. The purpose is to achieve a greater level of abstraction than possible with data/procedures-oriented design.

An application constructed with more finely granular objects (i.e. a lower number of functions per object) is likely to be more easily maintained because objects should be smaller and less complex.

More finely granular objects should also be more reusable. ... Therefore, each object's behavior should be more easily understood and analyzed.

                                 Total Number of Objects
      Application Granularity =  -------------------------
                                   Total Function Points"


Cited from:

Morris, K.L.: Metrics for Object-Oriented Software Development Environments. Master's Thesis, M. I. T. Sloan School of Management, 1989

SMlab's Homepage    <dumke@ivs.cs.uni-magdeburg.de>
Last modified: