Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Chidamber & Kemerer proposed several metrics for object oriented code. Among them, depth of inheritance tree, weighted number of methods, number of member functions, number of children, and coupling between objects. Using a base of code, they tried to correlated these metrics to the defect density and maintenance effort using covariant analysis.

Are these metrics actionable in projects? Perhaps they can guide refactoring. For example weighted number of methods might show which God classes needed to be broken into more cohesive classes that address a single concern.

Is there approach superseded by a better method, and is there a tool that can identify problem code, particularly in moderately large project being handed off to a new developer or team?

share|improve this question
2  
    
Thanks. I knew there were many follow up academic papers, many proposing additional metrics, some that analyzed large numbers of open source projects. Relative to your experience, are they paper tigers or do people use them? Are they tool supported? –  DeveloperDon Sep 6 '12 at 5:54
    
Well, it's not really easy to tell, some of the metrics are integrated into popular tools, along with a ton of other metrics, sometimes you might be using them and not even knowing ;) I know ndepend supports CK metrics for .Net projects, I'm sure other platforms have similar tools. –  Yannis Rizos Sep 6 '12 at 6:09
    
I haven't used CK metrics much, but I do make use of various other metrics (number of methods, cyclometic complexity, lines of code per class) to identify classes which are outside the norm in the project. These are often (but not always) ripe for refactoring, and you'd need to use your own judgement. I would definitely recommend this approach to others. –  Daniel B Sep 6 '12 at 12:02

2 Answers 2

up vote 5 down vote accepted

This is a tough question, and there is probably no "good" answer for it. The excellent comments posted by Daniel B. and Yannis Rizos are sound, and I'd argue further that the best metrics are those that you understand, along with their causes and consequences.

A recommended lecture for this would be the Goal-Question-Metric paradigm, by V. Basilic [1], further described by L. Westfall [2]. Once you defined your own need, then questions, then metrics, and if the CK metrics give you insights on this reduced set, then go for it.

To get back to the initial question (sic;), yes they are still used, even under the wood, as pointed out by Yannis. And for their meaning (complexity, maintainability) I find them relevant — this is clearly an opinion of mine.

As a side note, the CK metrics are first defined in [3] before being challenged by Subramanyam in [4].


[1] V. R. Basili, G. Caldiera, and H. D. Rombach, “The goal question metric approach,” Encyclopedia of Software Engineering, vol. 2. Wiley, pp. 528–532, 1994.

[2] L. Westfall and C. Road, “12 Steps to Useful Software Metrics[1],” Proceedings of the Seventeenth Annual Pacific Northwest Software Quality Conference, vol. 57 Suppl 1, no. May 2006, pp. S40–3, 2005.

[3] Shyam R. Chidamber and Chris F. Kemerer, “A Metrics Suite for Object Oriented Design[2],” vol. 315, no. December. 1993.

[4] R. Subramanyam and M. S. Krishnan, “Empirical Analysis of CK Metrics for Object-Oriented Design Complexity: Implications for Software Defects[3],” vol. 29, no. 4, pp. 297–310, 2003.

share|improve this answer
    
Thanks. I am a big Basili fan, and by adding the references, you are helping people get a much better picture of what I asked. –  DeveloperDon Oct 9 '12 at 10:24

There are quite a lot of static analysis tools that extract code metrics, and pretty much all of them will include some or all of the CK metrics. Most of the tools are language-specific; sonar is the only one I know that is not.

As for the usefulness: I'd say that guiding refactoring and identifying potentially problematic code is exactly what they are good for. But they should most definitely not be misused as a goal unto themselves.

share|improve this answer
    
Agree on second paragraph. As for the first, though, SQuORE can also analyse several different languages. –  Boris Baldassari Oct 26 '12 at 8:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.