Software bug: Difference between revisions

Content deleted Content added
review: syntax hilighting. add link, clarification.
Added a comma to 1000.
Line 80:
}} (linked from [https://insights.sei.cmu.edu/library/news-at-sei-1999-archive/ News at SEI 1999 Archive])</ref>
 
Some contend that ''bug'' may be used to [[coverup|cover up]] an intentional design decision. In 2011, after receiving scrutiny from US Senator [[Al Franken]] for recording and storing users' locations in unencrypted files,<ref>{{cite journal
|author=Gregg Keizer
|title=Apple faces questions from Congress about iPhone tracking
Line 120:
Some languages exclude features that easily lead to bugs, at the expense of slower performance {{endash}} the principle being that it is usually better to write simpler, slower correct code than complicated, buggy code. For example, the [[Java (programming language)|Java]] does not support [[pointer (computer programming)|pointer]] arithmetic which is generally fast, but is considered dangerous; relatively likely to cause a major bug.
 
Some languages include features that add runtime overhead in order to prevent some bugs. For example, many languages include runtime [[bounds checking]] and a way to handle out-of-bounds conditions instead of crashing.<!--[[User:Kvng/RTH]]-->
 
=== Techniques ===
Line 126:
Programming techniques such as [[programming style]] and [[defensive programming]] are intended to prevent typos.
 
For example, a bug may be caused by a relatively minor, [[typographical error]] (typo) in sourcethe code. For example, this code executes function {{code|foo}} only if {{code|condition}} is true.
 
<syntaxhighlight lang="c"> if (condition) foo();</syntaxhighlight>
 
But this code always executes {{code|foo}}:
 
<syntaxhighlight lang="c"> if (condition); foo();</syntaxhighlight>
 
A convention that tends to prevent this particular issue is to require braces for a block even if it has just one line.
 
if (condition) {
<syntaxhighlight lang="c">
if (condition) {
foo();
}
</syntaxhighlight>
 
Enforcement of conventions may be manual (i.e. via [[code review]]) or via automated tools.<!--[[User:Kvng/RTH]]-->
 
=== Specification ===
Line 265 ⟶ 263:
=== Cost ===
 
In 1994, NASA's [[Goddard Space Flight Center]] managed to reduce their average number of errors from 4.5 per 10001,000 lines of code ([[Source lines of code|SLOC]]) down to 1 per 1000 SLOC.<ref name=NASA1994>{{cite journal
|journal=Software Engineering Laboratory Series
|title=An Overview of the Software Engineering Laboratory