DEV Community

Cover image for Bug, Error, Defect, Failure Explained
Marc Backes
Marc Backes

Posted on • Originally published at marc.dev

Bug, Error, Defect, Failure Explained

Often, terms like error, bug, defect, failure are used interchangeably. But each one has its own meaning. In this post, I will explain the differences.

TD;DR

The following quote explains in a nutshell what you need to know about the differences between error, bug, defect, failure.

A coding mistake is called an error. The error found by the tester is called a defect. A defect accepted by the development team is called bug. If the software does not meet the requirements, then it is failure.

Error

An error happens during coding. This can be a range of things:

  • Syntax error (wrongly using the programming syntax)
  • Compiling error (the syntax is fine, but there is another problem during compilation, for example, the wrong use of a variable)
  • Runtime error (the program crashes when it is running)

In short, something that breaks the code. This always happens at the development side, so this is something the programmer/developer detects.

Defect

When a tester detects that the program does not behave the way it is supposed to, that is a defect.

A defect could be caused by an underlying error (but not necessarily). For example, this would happen if a JavaScript error is thrown due to a DOM element not being yet available, but the code is trying to access it. This would result in the rest of the code not running, ergo: Resulting in unexpected behavior.

However, the code could run error-free, but there still could be mistakes in the logic of the code. For example, updating a value in the database and forgetting to save that change. This would not cause an error; however, it would be a defect because the program doesn't behave as it is supposed to.

Defects are usually detected by testers.

Bug

When a defect, detected by a tester, is sent to the developer and they find that indeed it is due to a programming mistake, it is accepted as a bug.

The developer looks for the cause of the bug (debugging) and once the culprit is found, the bug is being fixed.

Fun fact: It is called bug, because in the early days of computing when electromechanical relays were used, and an actual bug (e.g., a moth) is trapped in a relay, causing the program to malfunction.

Failure

A failure is when the program can't work the way it was intended to, but not due to a programming mistake.

For example, this could be faulty software requirements (not specifying that something needs to be implemented) or other reasons, such as network problems not caused by the software. (Although the software should catch those programs and show the user an error).

Summary

Well, there you have it - the differences between an error, a defect, a bug, and a failure. So if next time there is a problem with the program, you can use the correct term, so everyone knows the nuance of the problem at hand.

Top comments (0)