我听说有人说(虽然我不记得具体是谁),无论使用什么语言,每行代码的错误数量大致恒定。支持这一点的研究是什么?
编辑添加 :我无权访问它,但显然是 this paper 的作者
“询问了用不同编程语言编写的程序每行代码 (LOC) 的错误数量是否相同的问题。”
最佳答案
在他的书中Code Complete (引自第 2 版),在“开发人员测试”一章中,Steve McConnell 引用了一些跨多种语言的研究:
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).
这些研究的范围从 Java 等高级语言,到 C++ 和 C,一直到汇编。考虑到 Code Complete 作为一门学科对软件工程的巨大影响,我怀疑它负责普及这个想法。
关于language-agnostic - 无论使用何种语言,每行代码的错误数量都是恒定的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2898571/