tags:

views:

163

answers:

4

Besides Cyclomatic Complexity what other code metric systems exist?

A: 

Code metrics

Do you find cyclomatic complexity a useful measure?

What code metric(s) convince you that provided code is “crappy”?

rahul
This is an answer?
Ira Baxter
This is an *accepted* answer?
Ira Baxter
+1  A: 

Halstead's Software Science is a fantastic metrics suite that can give you interesting insight into the actual constructs of your program.

There is a model created by Card and Glass as well, but I'm not sure if that is available outside of books. I would look for it regardless.

JoshJordan
+2  A: 

Wikipedia provides a simple overview of metrics.

There are actually lots, and lots of metrics. In fact, any function of the source code that maps source code to a measurement scale (integers, reals, classification enums) can be considered to be a metric.

The problem with most code metrics is that they tend to be proportional to SLOC, and if that's the case, SLOC is just as good. What is best to do with metrics is to measure your code now, and track how the metric changes over time; the trend, up or down, will tell you almost more than the metric will itself. Up means bad news; the code is getting more complicated.

It is also useful to consider code (complexity) metrics in conjunction with bug rates. A high complexity in a module, and and high bug rate in the same module, suggests that a redesign of that module may be a good idea to prevent further troubles in the field. High complexity and low bug rates would suggest the code looks scary but isn't.

Ira Baxter
A: 

Have a look at the 82 code metrics definitions supported by the tool NDepend integrated in Visual Studio 2010, 2008 and 2005.

Patrick Smacchia - NDepend dev