Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basis for claim that the number of bugs per line of code is constant regardless of the language used

I've heard people say (although I can't recall who in particular) that the number of bugs per line of code is roughly constant regardless of what language is used. What is the research that backs this up?

Edited to add: I don't have access to it, but apparently the authors of this paper "asked the question whether the number of bugs per lines of code (LOC) is the same for programs written in different programming languages or not."

like image 727
Matt R Avatar asked May 24 '10 16:05

Matt R


People also ask

What is bugs per line of code?

The Scope of the Problem On average, a developer creates 70 bugs per 1000 lines of code (!) 15 bugs per 1,000 lines of code find their way to the customers. Fixing a bug takes 30 times longer than writing a line of code. 75% of a developer's time is spent on debugging (1500 hours a year!)

What is the main cause of bugs in coding?

Bugs can be the result of incorrect communication about the project and its requirements. They can also come from a lack of communication, either about the project requirements, or between team members who are collaborating, leading to problems when they attempt to integrate their code.

What is the importance of finding the bugs in programming?

These bugs can affect the main functions of the software and make it not work correctly. Usually, they make the function perform an unintended action leading do to more significant problems.

What percentage of code is released into the market with bugs?

However, the industry average is below 85 percent. No software is 100 percent bugs-free. Bugs are common in all types of software, from applications to systems to programs.


2 Answers

In his book Code Complete (quoting from the 2nd Edition), in the chapter "Developer Testing," Steve McConnell cites a handful of studies across a variety of languages:

  • Industry average experience is about 1-25 errors per 1000 lines of code for delivered software. The software has usually been developed using a hodgepodge of techniques (Boehm 1981, Gremillion 1984, Yourdon 1989a, Jones 1998, Jones 2000, Weber 2003). Cases that have one-tenth as many errors as this are rare; cases that have 10 times more tend not to be reported. (They probably aren't ever completed!)

  • The Applications Division at Microsoft experiences about 10–20 defects per 1000 lines of code during in-house testing and 0.5 defects per 1000 lines of code in released product (Moore 1992). The technique used to achieve this level is a combination of the code-reading techniques described in Other Kinds of Collaborative Development Practices, and independent testing.

  • Harlan Mills pioneered "cleanroom development," a technique that has been able to achieve rates as low as 3 defects per 1000 lines of code during in-house testing and 0.1 defects per 1000 lines of code in released product (Cobb and Mills 1990).

These studies ranged from high-level languages like Java, down to C++ and C, all the way down to assembly. Considering the massive impact of Code Complete on software engineering as a discipline, I suspect it is responsible for popularizing this idea.

like image 50
s3cur3 Avatar answered Sep 28 '22 23:09

s3cur3


One possible source would be Les Hatton's 1995 paper "Computer programming languages and safety-related systems", in which he concludes that language choice is at least close to irrelevant and other factors (chiefly fluency in the chosen language) are the controlling factors.

About all I could add to that would be to summarize various other papers, in which defect rates for individual projects (and such) are given. I've done a bit of looking, and never found a correlation between language and defect rate, but that's not really the same as saying the defect rate is constant across languages (i.e., they may be different, but they vary so widely within each language that I've never been able to prove a difference).

like image 38
Jerry Coffin Avatar answered Sep 29 '22 01:09

Jerry Coffin