On Tue, Aug 28, 2007 at 11:20:43AM +0900, Ryan Davis wrote:
> 
> On Aug 26, 2007, at 13:43 , hadley wickham wrote:
> 
> >I don't think that invalidates the usefulness of an complexity per LOC
> >metric.  It's measuring something a little different, which still
> >might be useful.  Clearly the two sides of the statement have equal
> >complexity, but the RHS has lower complexity per LOC.
> 
> Which tells you what? In what way is that useful?

It tells you that you aren't trying to cram too many things into a single
line of code.  (It also might tell you that you're taking the idea of
making each discrete line simple a little too far.)  In addition to
keeping the program as simple and clean as possible (without sacrificing
what the program needs), it's also generally important to avoid making
individual lines too complex.

On the other hand, I don't think an average line complexity is all that
useful a metric, unless your code is so severely over-complex per line
that it shows an outrageously high average complexity -- in which case,
it should be obvious to you anyway (and if it isn't, you may want to give
up programming for a career in bureaucratic middle management in the
public sector instead).  Line complexity really needs to be judged on a
case-by-case basis.  I can understand the desire to get some kind of line
complexity measure, though, even if I think an average per se is not the
best way to do it.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Brian K. Reid: "In computer science, we stand on each other's feet."