OOP Metrics

 

There are many kinds of posssible OOP metrics that can be used. Here are a few that have been used (or variations of them)

 

Ave. Methods/Class

 

                                           Total No. of Methods
 Average No. of Methods per Object Class = --------------------------
                                          Total No. of Object Classes
Value Code Reuse Extensibility Testing Comprehension
higher higher worse more complicated ?


Inheritance Dependency

have inheritance tree(s)

Inheritance Tree Depth = max{Inheritance Tree Path Length} 

Value Code Reuse Extensibility Testing Comprehension
higher higher than greater tree breadth ? more complicated lower

Coupling:     Degree between Objects

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

Arcs - in an Object Use-Case

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

Arcs - attached to any single object in a use-case
Value Code Reuse Extensibility Testing Comprehension
higher, more coupling lower lower more complicated lower

Object Library Effectiveness

Average Number of Times a Library Object is Reused:
                    Total Number of Object Reuses
   Average Number = -----------------------------
                    Total Number of Library Objects 

 
Value Code Reuse Extensibility Testing Comprehension
higher higer N/A N/A N/A

Factoring Effectiveness

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

Value Code Reuse Extensibility Testing Comprehension
higher higher ? lower? N/A more reliable and easily maintained, less error in using methods

Degree of Reuse of Inheritance Methods

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 

Value Code Reuse Extensibility Testing Comprehension

PP
higher

higher N/A N/A easier
PM higher higher higher N/A easier?

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"

 

Value Code Reuse Extensibility Testing Comprehension

higher

higher higher easier higher

 

© Lynne Grewe