[racket] code metrics

From: John Clements (clements at brinckerhoff.org)
Date: Wed May 30 12:25:41 EDT 2012

On May 30, 2012, at 12:07 AM, Neil Van Dyke wrote:

> There is some code coverage instrumentation in the "errortrace" library, and I believe the DrRacket has some kind of coverage feature.

In addition to single-file coverage, there's also the multi-file coverage tool that one of my senior project students produced,

(planet jowalsh/code-coverage)

You might be interested in using it directly, or just in reading the code to understand how one might interact with the coverage engine.  I believe the entire source of the package is under four hundred lines.

John Clements

> 
> The other metrics you mention are very easy to get.  How useful they are is a different question, and depends on why you're asking.
> 
> Aside: code metrics are of course useful for convincing managers of things:
> 
> WRONG: "We've been making steady progress on functionality and QA, and the schedule feels tighter than last month, but people have been staying late, we're still on track for our weekly milestones, and morale is still pretty good.  We just don't have wiggle room to absorb any more surprises without slipping."
> 
> RIGHT: Ensure that the line count increases monotonically, whether or not that's good practice. "We have been producing average 9,876 new lines of code a day, and so are on track to our milestone of 300,000 new lines by the end of Q2."
> 
> WRONG: "We think it would take our best available developer more than a month to develop that functionality, but Acme has a component that does exactly what we need and that we think will be very quick to integrate."
> 
> RIGHT: "Acme answered our inquiry that their off-the-shelf component has 40,000 SLOC of code, so if we multiply that by our cost metric of 12.3 cents per SLOC, the Acme $3,000 royalty-free license gives us a cost savings of $1,920."
> 
> WRONG: "Everyone on the team is saying that the bit-rotted old library is slowing us down, and we think that Jim spending a couple days refactoring it in a few specific ways that he identified would be an immediate big win."
> 
> RIGHT: "Thanks to the software metrics tiger team that I led, we've learned that three of the key functions in the old library have McCabe cyclomatic complexity over 100, which, gentlemen, we all know is bad.  I propose we task some resources to cut that in half, which we all know is better.  In fact, I have a new initiative to boost productivity by simplifying our code and bringing this number down to 10.  Heck, why be followers when we can be leaders: we're going to five blades."
> 
> Neil V.
> 
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4800 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120530/e6f33b69/attachment-0001.p7s>

Posted on the users mailing list.