Question

The terms debugging and antibugging seem to be widely used for referring to tools, measures and design patterns to get rid of bugs.

After reading Peter Norvig's Paradigms of Artificial Intelligence Programming: Case Studies in Common LISP I was not sure about the difference between those terms:

It is a good idea to include antibugging checks in your code in addition to doing normal debugging. Antibugging code checks for errors and possibly take corrective actions.

And further:

It may seem like wasted effort to spend time writing assertions that (if all goes well) will never be used. However, for all but the perfect programmer, bugs do occur, and the time spent antibugging will more than pay for itself in saving debugging time. Whenever you develop a complex data structure, such as some kind of data base, it is a good idea to develop a corresponding consistency checker. A consistency checker is a function that will look over a data structure and test for all possible errors. When a new error is discovered, a check for it should be incorporated into the consistency checker. Calling the consistency checker is the fastest way to help isolate bugs in the data structure. In addition, it is a good idea to keep a list of difficult test cases on hand. That way, when the program is changed, it will be easy to see if the change reintroduces a bug that had been previously removed. This is called regression testing, and Waters (1991) presents an interesting tool for maintaining a suite of regression tests.

And here is another example from a lecture called "Programming Language Paradigms" at the University of San Francisco (Chris Brooks, 2004). There, as @Max3k pointed out in this post,

it seems that "antibugging" is a term that covers many good practices and/or the resulting code. It mentions defensive programming, throwing and catching exceptions, named exceptions, (unit) testing. Also according to the source just using a strongly typed langue over a dynamic one, would mean that you are "antibugging".

Yet another reference, many thanks to @CandiedOrange:

Antibugging means "defect avoidance", as opposed to debugging, which means "defect removal".

C through design - George E. Defenbaugh, Richard Smedley Franklin, Beedle, 1988 p16

So I googled further for having a precise and objective answer but wasn't able to get an authoritative answer, nor do I have much experience on that (as until now I did just "domestic" projects).

Can you tell me the difference between the two terms in order to distinguish them and use them correctly ?

DISCLAIMER Antibugging seems not yet to be as globally accepted as I thought. But there is evidence that some reputed people are using both terms, and both in the academia and the industry. I think this justifies the question and show that this is not opinion based.

Was it helpful?

Solution

The term

The term antibugging or anti-bugging is not widely used: around 2000 Google occurrences (part of them being related to devices for spyware removal !) compared to 33 millions for debugging !

It was first used by Ed Yourdon, the software engineering pioneer, in his book "Techniques of Program Structure and Design" published in 1975.

It's strange that it didn't gain the popularity of other ideas promoted by Yourdon, such as structured analysis and structured design or Yourdon/DeMarco dataflow modeling.

But despite its seldom use, the term gains to be known.

Debugging

The goal of debugging is to catch and correct errors, especially in an early stage, and provide tools to support bug finding, should they happen later in production. Debugging is primarily performed in relation with coding. For example:

  • assertion checks of pre- and post-conditions at begin or ending of functions (if they fail, the execution aborts),
  • logging in order to be able to analyse cause of bugs if they happen,
  • extensive testing to find potential bugs,
  • overnight coffee driven activity til exhaustion or the bug exterminated.

Except some general purpose code to support debugging (especially logging), debugging wouldn't directly influence software structure IMO.

Antibugging

The goal of antibugging is to prevent bugs from happening. This activity performed throughout the whole development process. For example:

  • design that prevents conditions of bugs
  • defensive coding that prevent error propagation and that ensure that the special case is properly handled
  • automatic error correction or recovery strategies (e.g. relaunching a service that aborted but is needed)

This kind of prevention should be undertaken from the start of the development and should be rooted in the design and the software structure (e.g. API design, exception management). It could hence influence the software architecture. And it includes also traditional defensive programming, to ensure offer an alternate path of execution to gracefully handle error conditions.

So debugging and antibugging have clear boundaries.

But where does it end ?

IMO it is much more difficult to distinguish antibugging and sound software design practices. For instance, is encapsulation antibugging, just because it will prevents bugs through reduction of unexpected side effects ? Is a state design pattern antibugging, because it prevents behavior to happen which is not in line with an object's state ? ... and so on.

In practice I'd therefore keep focus on prevention of concrete and probable bugs -- error situation that could happen--, instead of viewing it too broadly to prevent bugs of code that will never be written, keeping sound design principles as something distinct from antibugging.

Further reading:

OTHER TIPS

Firstly, antibugging isn't a commonly used term, a few people use it, but it won't be generally recognized.

For those people that do use it, they mean practices to avoid writing bugs in the first place rather than removing bugs after they are found.

Debugging is the act of correcting defects in software code.

Antibugging "checks for errors and possibly takes corrective action"
Paradigms of Artificial intelligence programming: Antibugging s3.14 p87

Yes that sounds a bit the same but they also mean this:

enter image description here

What they're describing is what came to be known as validation. We check that we're in a valid state before we go and do something to spread our confusion around. Where they have a cerror (continuable error) others throw and catch exceptions.

So no, this isn't debugging at all. Debugging is fixing defects in code. Code defects come from the programmers. This Antibugging is fixing defects in state. You can get bad state from any input: user, file, internet, those programmers again...

Google books helped me dig up a more formal definition:

Antibugging means "defect avoidance", as opposed to debugging, which means "defect removal".

C through design - George E. Defenbaugh, Richard Smedley Franklin, Beedle, 1988 p16

Which sounds to me like, stuff you do to keep someone from filing a trouble ticket, not stuff you do after they do.

Licensed under: CC-BY-SA with attribution
scroll top