views:

170

answers:

8

Hi

I have to submit a paper about the usage of source code metrics in software engineering processes. I thought it would be nice to start by introducing some categorization of source code metrics (for example using plane LOC count Vs doing some static analysis of the code) , but I can't find a book or article that will present the different types of metrics and possibly some historical background information (books and article are favored by my instructor over web sites).

any one knows of such a source ?

+1  A: 

Pressman's Software Engineering: A Practitioner's Approach has a lot of good information on software metrics (among other things).

Probably the key piece of advice on metrics is to be careful what you measure. If you measure LOC, that's what people will concentrate on.

"Not everything that can be counted counts, and not everything that counts can be counted."

--Albert Einstein

"Measuring software productivity by lines of code is like measuring progress on an airplane by how much it weighs."

--Bill Gates

Bill the Lizard
never heard that Bill Gates quote before. good one
Mitch Wheat
@Mitch: One of my favorites. It's such a perfect and concise analogy. Much better than his (probably more famous) quote about how much memory anyone will ever need. :)
Bill the Lizard
Apparently, he denies ever making the latter...
Mitch Wheat
@Mitch: I hadn't realized that, but apparently he denies it very strongly. http://en.wikiquote.org/wiki/Bill_Gates#Misattributed
Bill the Lizard
Bill the Lizard: Thank you for suggesting this book, it is exactly what I was looking for. it was literally right in front of my face, on the shelves in front of the the desk I am currently working on -:))
Kent
@Kent: Wow! I mean... uh... yeah, I knew it was there the whole time. ;)
Bill the Lizard
Actually, Gates is off-base on that one. EVERYONE who has ever worked for an airplane company knows that an airplane is NEVER ready to fly until the documentation (drawings, plans, manuals, you name it) weighs more than the airplane does. Airplanes are COMPLEX systems, and there are no shortcuts to engineering them.
John R. Strohm
you mean like the Airbus that's in production with the software control fault?
Mitch Wheat
+2  A: 

Patrick Smacchia's NDepend site has a good set of definitions: Metrics Definitions. His NDepend tool (for .NET) provides many different ways of quantifying a codebase.

How useful metrics are, well that is a bit more contentious. They are good for getting a sky level view of a codebase, but are they useful day-to-day? How many shops out there use (or care about) metrics on a weekly basis? I suspect most are more concerned with the bug count: number of bugs fixed and number of bugs reported.

Certainly measures like cohesion and coupling give indicators of possible refactoring points.

Another important metric: How many tests are there, and roughly how much code coverage do those tests represent. Refactoring without tests and good test coverage is a risky business.

Software metric

Code Metrics Overview

Mitch Wheat
thx for those punishment votes sam
Mitch Wheat
A: 

Halstead's "Elements of Software Science" was the seminal work in this area. As I recall the tale, he defined some 15 different metrics, all purporting to measure different qualities of a piece of code.

Unfortunately, van der Meulen & Revilla showed that a couple of key metrics are very strongly correlated with SLOC (source lines of code). (This was not the first time this had been demonstrated, but it was the first paper I could find quickly.) Since SLOC is far easier to measure than the other things, SLOC is what should be measured - and managed.

John R. Strohm
Halstead's book struck me as pure pseudo-science. He talked about a "software physics" and came up with equations that purported to compute things like "Effort" from source code. I don't believe it was tied into any empirical measurement. So I'm with your second reference on that.
Jim Ferrans
+1  A: 

Metrics and Models in Software Quality Engineering

Stephen H. Kan

alt text

Not always very fun to read, but it's an excellent book that covers software quality and metrics in depth.

JRL
A: 

Also check SLOCCount. This is not a book but a set of tools for counting physical Source Lines of Code. Going through its user manual and the papers in the site about the usage of SLOCCount for estimating Linux kernel size will give you insight about effectiveness of SLOC metrics,issues in using it as metric, usage of SLOC metric in the COCOMO model for effort estimate.

sateesh
A: 

It's not a book, but the metrics used by Sonar offer a good list of practically useful code metrics. Here's the metric definitions page.

ire_and_curses
A: 

As I just mentioned in my question on visualizing changes in metrics, there are the books Object-Oriented Metrics:Measures of Complexity by Henderson-Sellers and the earlier Object-Oriented Software Metrics which I've owned for years.

There's Metrics and Models in Software Quality Engineering, Second Edition, the only one of the books available on Safari which has a chapter discussing the above metrics and some industry results.

I also just found a 2006 book Object-Oriented Metrics in Practice: Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems which has no reviews there (not a good sign) but sounds interesting.

Andy Dent

related questions