Posted by: Colin Smith
Debugging, Software Quality, Software testing, Software testing tools
Debugging is often challenging for programmers, so much so that many books have been written about it. One of the latest to hit the shelves is The Art of Debugging with GDB, DDD, and Eclipse written by Norman Matloff and Peter Jay Salzman and published by No Starch Press.
According to Matloff, debugging is challenging because “you’re looking for a needle in a haystack. And in many cases, the bug turns out to be in the portion of the program you’re most sure is correct!”
And that, he said, is one of the most common pitfalls programmers encounter. They’re sure that some part of a code is correct when in actuality that is where the bug is hiding. Additionally, Matloff said, some programmers will not use a debugging tool.
What can programmers do to avoid those pitfalls?
“In our book, we put forth a key guideline that we call the Principle of Confirmation, which says that debugging is basically a process of confirming that what you think really is true. Eventually you find an assertion that fails to confirm, and then you’ve likely pinpointed the location of the bug,” Matloff said.
Of the debugging tools out there, Matloff says the benefits open-source tools includes the ability for them to be used on any of the major platforms — Linux, Mac, and Windows.
“Thus you can have the same environment available to you even if you work on several different kinds of systems,” he said.
When asked if there are issues that make debugging more critical these days, Matloff said there is much debate about this.
“For example, some people think that strongly typed languages are “safer,” i.e. less bug-prone, while others believe that such languages complicate the code so much that they generate MORE bugs,” he said.
What do you think? Are some languages safer than others? Do you have any tips for making the debugging process easier?