无论使用何种语言,每行代码的错误数量都是恒定的,这一说法的依据

发布于 2024-09-03 06:40:18 字数 248 浏览 12 评论 0原文

我听人说过(虽然我不记得具体是谁),无论使用什么语言,每行代码的错误数量大致是恒定的。支持这一点的研究是什么?

编辑添加:我无权访问它,但显然是 本文 “询问用不同编程语言编写的程序每行代码 (LOC) 的错误数量是否相同。”

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."

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

脱离于你 2024-09-10 06:40:18

Steve McConnell 在他的书 Code Complete(引自第二版)的“开发人员测试”一章中引用了一些跨多种语言的研究:

  • 对于交付的软件,行业平均经验是每 1000 行代码大约有 1-25 个错误。软件通常是使用大杂烩技术来开发的(Boehm 1981、Gremillion 1984、Yourdon 1989a、Jones 1998、Jones 2000、Weber 2003)。错误数量只有此十分之一的情况很少见;超过 10 倍的病例往往不会被报告。 (它们可能从未完成!)

  • Microsoft 应用程序部门在内部测试期间每 1000 行代码大约有 10-20 个缺陷,在发布的产品中每 1000 行代码大约有 0.5 个缺陷(Moore 1992)。用于达到此级别的技术是其他类型的协作开发实践中描述的代码读取技术和独立测试的组合。

  • Harlan Mills 开创了“洁净室开发”技术,该技术在内部测试期间能够实现低至每 1000 行代码 3 个缺陷的比率,并且在发布的产品中实现每 1000 行代码 0.1 个缺陷的比率(科布和米尔斯 1990)。

这些研究范围从 Java 等高级语言,到 C++ 和 C,一直到汇编。考虑到 Code Complete 对软件工程作为一门学科的巨大影响,我怀疑它对普及这一想法负有责任。

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.

过去的过去 2024-09-10 06:40:18

一个可能的来源是 Les Hatton 1995 年的论文“计算机编程语言和安全相关系统”,他得出的结论是,语言选择至少接近无关紧要,其他因素(主要是所选语言的流利程度)是控制因素。

我能补充的就是总结各种其他论文,其中给出了各个项目(等)的缺陷率。我做了一些研究,但从未发现语言和缺陷率之间存在相关性,但这并不等同于说缺陷率在不同语言之间是恒定的(即,它们可能是不同的,但它们在每种语言中的差异如此之大,以至于我无法证明差异)。

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文