3

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.

3

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:

  • Although it's not "complete" in an encyclopedic way (some of Yourdon's quotations would be great) I accepted it because it comprises historical view, clear and analytical comparation between both terms regarding principles and practices, and an exposition of the discussion boundaries, clearly separated from the own given opinion. Apart from the further valuable sources given – fr_andres Sep 28 '16 at 21:12
  • 1
    @fr_andres Thanks ! Yourdon has a full chapter about that topic in his book (books.google.be/…). I don't have the book but it's available as reprint for around 6$ on a famous online bookstore. If you browse on google scholars (scholar.google.be/…) you'll find some work that refers to Yourdon's approach on antibugging with some quotes. – Christophe Sep 28 '16 at 21:38
13

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.

  • In the link I provide it's not referred as a practice but as code... and I don't see the people at Google discussing the term with their research director... another example from the academia cs.usfca.edu/~brooks/F04classes/plp/slides/antibugging.pdf – fr_andres Sep 25 '16 at 0:52
  • @fr_andres, antibugging code is a subset of antibugging practice. – Winston Ewert Sep 25 '16 at 0:59
  • 3
    Yeah, is the first time that I hear about antibugging. – miso Sep 25 '16 at 6:03
  • 6
    I haven't encountered this term once in 23 years of professional programming and hundreds of books, and I think it's worse than "defensive programming". (And now I've admitted that I was never able to finish Paradigms of Artificial Intelligence Programming...) – Kilian Foth Sep 26 '16 at 6:43
  • 1
    The book Perl Debugged by Peter Scott has an entire chapter about Anti-bugging and describes it as: "a set of programming techniques that minimize the probability of introducing a bug to a program at design time or input, You could also call it defensive programming." I would summarize the difference between Anti-bugging and Debugging in the emergency management terms: Prevention vs. Mitigation/Correction . – spoorcc Sep 27 '16 at 16:08
5

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.

  • 1
    So "antibugging" is the same as defensive programming? – Pete Sep 25 '16 at 8:04
  • 1
    @PietervandenHam: According to cs.usfca.edu/~brooks/F04classes/plp/slides/antibugging.pdf 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". – Ma3x Sep 25 '16 at 8:15
  • @Ma3x exactly! and when approaching "debugging" with the same precision, we see it is also applied to a whole ecosystem of tools, practices and design patterns (even program metamorphosis could be seen as such creichen.net/dissertation.pdf). So any valid answer is definitely not a four-liner to me – fr_andres Sep 25 '16 at 14:38
  • CandiedOrange thank you very much for pointing to state validation, +1. I could get my hands into Norvig's book and edited my post with the chapter conclusions (it is truncated in the googleBooks link) in case you are also intereseted – fr_andres Sep 25 '16 at 14:39
  • great reference in the edit! i'm going to put it in the question, thanks – fr_andres Sep 26 '16 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.