Monday, May 30, 2005

Important Metrics

"Decades of evidence say that routines of such length are no more error prone than shorter routines...issues such as the routine's cohesion, depth of nesting, number of variables, number of decision points, number of comments needed to explain the routine and other complexity related considerations dictate the length of the routine rather than imposing a length restriction per se."

From Code Complete (2nd Edition) pp173-174

Empirical Analysis of CK Metrics for Object-Oriented Design Complexity: Implications for Software Defects More significant metrics seem to be:
* DIT - Depth of Inheritance Tree (the deeper the worse/the more clumped together the better).
* NOC - Number of child classes (more the better - reuse leads to better quality).
* NOM - Number of methods per class (the less the better).
* NOV - Number of variables (the fewer the better).

Good summary of defects to metrics on page 3 here.

An Empirical Comparison of Modularity of Procedural and Object-oriented Software Average of 7.5 lines of code per method in Java.

"This design flaw, is one of the "smells" presented in [7]. It refers
to classes that define data fields and almost no methods except some
accessor methods for the data fields."

Data objects and code smells:
* Detecting Design Flaws via Metrics in Object-Oriented Systems
* Detection Strategies: Metrics-Based Rules for Detecting Design Flaws

No comments: