0% found this document useful (0 votes)
122 views13 pages

Understanding Computer Bugs and Types

The document discusses computer bugs, defining them as errors or flaws in software that lead to unexpected behavior. It outlines various causes of bugs, including mistakes in requirements, design, and implementation, as well as common types of bugs such as arithmetic, logic, and performance bugs. Additionally, it suggests ways to handle bugs through programming style, techniques, methodologies, language support, and code analysis tools.

Uploaded by

upgradedbwire46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views13 pages

Understanding Computer Bugs and Types

The document discusses computer bugs, defining them as errors or flaws in software that lead to unexpected behavior. It outlines various causes of bugs, including mistakes in requirements, design, and implementation, as well as common types of bugs such as arithmetic, logic, and performance bugs. Additionally, it suggests ways to handle bugs through programming style, techniques, methodologies, language support, and code analysis tools.

Uploaded by

upgradedbwire46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Department of Information Communication

Technology

IET04203-Principles of Computer Support and


Maintenance

Computer Bugs
Computer Bugs
What is a computer bug?
Is an error, flaw, failure, or fault in a computer program or
system that produces an incorrect or unexpected result, or
causes it to behave in unintended ways.
Causes of computer bugs
• Most bugs arise from mistakes and errors made by people
in either a program's source code or its design,
• In frameworks and operating systems used by such
programs
• Compilers producing incorrect code.
Sources of Problems
• Requirements Definition: Erroneous, incomplete,
inconsistent requirements.
• Design: Fundamental design flaws in the software.
• Implementation: Mistakes in chip fabrication, wiring,
programming faults, malicious code.
• Support Systems: Poor programming languages,
faulty compilers and debuggers, misleading
development tools.
Sources of Problems (Cont’d)
• Inadequate Testing of Software: Incomplete testing, poor
verification, mistakes in debugging.
• Evolution: Sloppy redevelopment or maintenance,
introduction of new flaws in attempts to fix old flaws,
incremental escalation to inordinate complexity.
Bug in Space Code
• Project Mercury’s FORTRAN code had the following fault:
DO I=1.10 instead of ... DO I=1,10
• The fault was discovered in an analysis of why the
software did not seem to generate results that were
sufficiently accurate.
• The erroneous 1.10 would cause the loop to be executed
exactly once!
A software Bug occurs when at least
one of these rules is true
• The software does not do something that the specification
says it should do.
• The software does something that the specification says it
should not do.
• The software does something that the specification does
not mention.
• The software does not do something that the product
specification does not mention but should.
• The software is difficult to understand, hard to use, slow …
Most bugs are not because of
mistakes in the code …

• Specification (~= 55%)


• Design (~= 25%)
• Code (~= 15%)
• Other (~= 5%)
Common types of Computer Bugs
• Arithmetic bugs
Division by zero, Loss of arithmetic precision due to
rounding or numerically unstable algorithms.
• Logic bugs
Infinite loops and infinite recursion, Off by one error,
counting one too many or too few when looping.
• Syntax bugs
Use of the wrong operator, such as performing assignment
instead of equality test. For
example, in some languages x=5 will set the value of x to 5
while x==5 will check
Common types of Computer Bugs
• Resource bugs
Using an unutilized variable, Using an otherwise valid
instruction on the wrong data type (see packed
decimal/binary coded decimal).
• Multi-threading programming bugs
Deadlock, where task A can't continue until task B finished,
but at the same time, task B can't continue until task A
finishes.
Common types of Computer Bugs
• Interfacing bugs
Incorrect API usage, Incorrect protocol implementation,
Incorrect hardware handling, Incorrect assumptions of a
particular platform.
• Performance bugs
Too high computational complexity of algorithm, Random
disk or memory access.
• Team working bugs
Unpropagated updates; e.g. programmer changes "myAdd"
but forgets to change "mySubtract", which uses the same
algorithm.
Comments out of date or incorrect: many programmers
assume the comments accurately describe the code.
Differences between documentation and the actual product.
Ways to handle Bugs
• Programming style
While typos in the program code are often caught by the
compiler, a bug usually appears when the programmer
makes a logic error. Various innovations in programming
style and defensive programming are designed to make
these bugs less likely, or easier to spot.
• Programming techniques
Bugs often create inconsistencies in the internal data of a
running program. Programs can be written to check the
consistency of their own internal data while running.
Ways to handle Bugs
• Development methodologies
There are several schemes for managing programmer
activity, so that fewer bugs are produced.
• Programming language support
Programming languages often include features which help
programmers prevent bugs, such as static type systems,
restricted name spaces and modular programming, among
others.
• Code analysis
Tools for code analysis help developers by inspecting the
program text beyond the compiler's capabilities to spot
potential problems.

You might also like