Debugging

FIELDS OF STUDY

Computer Science; Software Engineering

ABSTRACT

Debugging is the process of identifying and addressing errors, known as “bugs,” in computer systems. It is an essential step in the development of all kinds of programs, from consumer programs such as web browsers and video games to the complex systems used in transportation and infrastructure. Debugging can be carried out through a number of methods depending on the nature of the computer system in question.

PRINCIPAL TERMS

UNDERSTANDING DEBUGGING

Debugging is the process of testing software or other computer systems, noting any errors that occur, and finding the cause of those errors. Errors, or “bugs,” in a computer program can seriously affect the program's operations or even prevent it from functioning altogether. The goal of debugging is to get rid of the bugs that have been identified. This should ensure the smooth and error-free operation of the computer program or system.

Computer programs consist of long strings of specialized code that tell the computer what to do and how to do it. Computer code must use specific vocabulary and structures to function properly. As such code is written by human programmers, there is always the possibility of human error, which is the cause of many common bugs. Perhaps the most common bugs are syntax errors. These are the result of small mistakes, such as typos, in a program's code. In some cases, a bug may occur because the programmer neglected to include a key element in the code or structured it incorrectly. For example, the code could include a command instructing the computer to begin a specific process but lack the corresponding command to end it.

Bugs fall into one of several categories, based on when and how they affect the program. Compilation errors prevent the program from running. Run-time errors, meanwhile, occur as the program is running. Logic errors, in which flaws in the program's logic produce unintended results, are a particularly common form of bug. Such errors come about when a program's code is syntactically correct but does not make logical sense. For instance, a string of code with flawed logic may cause the program to become caught in an unintended loop. This can cause it to become completely unresponsive, or freeze. In other cases, a logic error might result when a program's code instructs the computer to divide a numerical value by zero, a mathematically impossible task.

WHY DEBUG?

Bugs may interfere with a program's ability to perform its core functions or even to run. Not all bugs are related to a program's core functions, and some programs may be usable despite the errors they contain. However, ease of use is an important factor that many people consider when deciding which program to use. It is therefore in the best interest of software creators to ensure that their programs are as free of errors as possible. In addition to testing a program or other computer system in house prior to releasing them to the public, many software companies collect reports of bugs from users following its release. This is often done through transfers of collected data commonly referred to as memory dumps. They can then address such errors through updates known as software patches.

While bugs are an inconvenience in consumer computer programs, in more specialized computer systems, they can have far more serious consequences. In areas such as transportation, infrastructure, and finance, errors in syntax and logic can place lives and livelihoods at risk. Perhaps the most prominent example of such a bug was the so-called Y2K bug. This bug was projected to affect numerous computer systems beginning on January 1, 2000. The problem would have resulted from existing practices related to the way dates were written in computer programs. However, it was largely averted through the work of programmers who updated the affected programs to prevent that issue. As the example of the far-reaching Y2K bug shows, the world's growing reliance on computers in all areas of society has made thorough debugging even more important.

DEBUGGING IN PRACTICE

Programmers use a wide range of tools to debug programs. As programs are frequently complex and lengthy, automating portions of the debugging process is often essential. Automated debugging programs, or “debuggers,” search through code line by line for syntax errors or faulty logic that could cause bugs. A technique known as delta debugging provides an automated means of filtering out irrelevant information when the programmer is looking for the root cause of a bug.

Different types of programs or systems often require different debugging tools. An in-circuit emulator is used when the computer system being tested is an embedded system (that is, one located within a larger system) and cannot otherwise be accessed. A form of debugging known as integration testing is often used when a program consists of numerous components. After each component is tested and debugged on its own, they are linked together and tested as a unit. This ensures that the different components function correctly when working together.

HISTORICAL NOTE

The first computer bug was an actual bug (insect) that had flown into one of the old vacuum tube computers and fried itself. The name stuck even after the technology changed.

—Joy Crelin

Foote, Steven. Learning to Program. Upper Saddle River: Pearson, 2015. Print.

McCauley, Renée, et al. “Debugging: A Review of the Literature from an Educational Perspective.” Computer Science Education 18.2 (2008): 67–92. Print.

Myers, Glenford J., Tom Badgett, and Corey Sandler. The Art of Software Testing. Hoboken: Wiley, 2012. Print.

St. Germain, H. James de. “Debugging Programs.” University of Utah. U of Utah, n.d. Web. 31 Jan. 2016.

“What Went Wrong? Finding and Fixing Errors through Debugging.” Microsoft Developer Network Library. Microsoft, 2016. Web. 31 Jan. 2016.

Zeller, Andreas. Why Programs Fail: A Guide to Systematic Debugging. Burlington: Kaufmann, 2009. Print.