TITLE: debugging complexity and lines of code metrics (Newsgroup: comp.lang.c++.moderated, 6 Aug 2000) GLASSBOROW: Francis Glassborow |>>> And debug time is proportional to at least the square |>>> of the number of lines of code:) STRUSTRUP: Bjarne Stroustrup |>> That is common knowledge, but is it true? HERWIN: herwin@gmu.edu (Harry Erwin) |> Excellent question. See Musa et al, 1987, Software Reliability, page |> 116. They quote numbers that suggest the number of bugs is linear in |> the SLOC count. Barry Boehm's CoCoMo studies also suggest that development |> effort is close to linear in the SLOC count. The hidden assumption for |> both is well-designed code, but I suspect a square law is too big in |> any case. KANZE: kanze@gabi-soft.de A more significant measure might be the average number of lines of code per function, or something like that. But this still leaves open: - assertions, invariant checks, etc., which increase the line count, but reduce debugging time, and - the complexity of the individual lines. I once had to maintain code written by a programmer who apparently believed that for loops should be empty. With some creative use of the comma operator, he generally succeeded, but I'm sure that my versions, even spread over 7 or 8 lines of code, required less debugging (and many collegues have contented that my code is too dense). Another factor to consider, at least in larger projects, is the process. Finally: my experience has been that if a minimum of care is taken during design and implementation, debugging represents less than 10 per cent of the total development time anyway. _______________________________________________ cpptips mailing list http://cpptips.hyperformix.com