Rob Smyth

Tuesday 14 April 2009

Iffy Density - A Useful Metric?

Any mention of code metrics is on slipery ground. Metrics are good, given a problem, and are best only used until the problem is solved...


I wonder if an 'Iffy Density' (my invention until I'm told otheriwse) is a useful metric to indicate code health and probable defect density.

Iffy Density is a measure of the number of 'if' / 'case' statements within a method or class. Will these add to code's TLA infestion with MID and CID :-)?

2 comments:

Nigel Thorne said...

isn't that what cyclometic complexity gives you? an idea of the number of paths through a function. (hence how many 'if's )

Rob Smyth said...

Yup, very similar (does not count 1 for the method). I was hoping you would make this comment. :-)

I put forward Iffy Density to promote communication. Say cyclometric complexity and watch the eye lids fall ... by say 'Iffy Density' and you are instantly communicating something.