Skip to main content

Debuggers are a wasteful Timesink

Posted by daniel on December 1, 2003 at 9:07 AM PST

Bob Martin writes, "As debuggers have grown in power and capability, they have become more and more harmful to the process of software development."

We lead off Also in Java Today with a link to Uncle Bob's weblog entry Debuggers are a wasteful Timesink. It struck a nerve because I had just sent out an email to someone to the effect that I haven't used a debugger in the last two years when I read John Mitchell's entry linking to this thread.

I said goodbye to the debugger shortly after driving to Chicago to spend a week in an XP Immersion run by Bob Martin and Ron Jeffries and others. I've never liked the debugger but always worked with people who swore by it. They happily stepped in and out of methods and checked values of variables and nodded their heads knowingly. Some used the tool to quickly locate problems and others seemed to gather tons of information but no insight.

Bob writes that "The kinds of bugs I have to troubleshoot are easily isolated by my unit tests, and can be quickly found through inspection and a few judiciously placed print statements." He warns that there are programmers who stop depending on their own insight and instincts and instead blindly depend on a debugger. He argues that "a debugger is a tool of last resort. Once you have exhausted every other avenue of diagnosis, and have given very careful thought to just rewriting the offending code, *then* you may need a debugger."

One response to Bob's post is that a debugger is a useful tool when trying to navigate and find the source of problems in someone else's code. This includes a pointer to our other linked article today. The ACM Queue article by George V. Neville-Neil Code Spelunking: Exploring Cavernous Code Bases. Neville-Neil writes "Code spelunking is very different from other engineering practices because it is done long after the initial design and implementation of a system. It is a set of forensic techniques used after the crime has been committed."

In particular, the article points to the problem of "attempting to fix a bug in an unfamiliar piece of code. Debugging is a highly focused task: You have a program, it runs, but not correctly. You must find out why it does this, where it does this, and then repair it. What's wrong with the program is usually your only known quantity. Finding the needle buried in the haystack is your job, so the first question must be, 'Where does the program make a mistake?'"

The article points to mistakes that are best handled by a debugger and those that aren't. For example locating a problem "where the code doesn't crash but only produces incorrect results, is more difficult because there isn't a trivial way to get a debugger to show you when to stop the program and inspect it. "

It is interesting to return to the forum and follow the thread that Uncle Bob started. He is suggesting that perhaps the debugger is overused and that there might be a benefit in taking a step back and noticing which tools you reach for and questioning when and why.

In Weblogs , Jack Shirazi announces the November Java Performance News. I look forward to his monthly announcements and usually feature an article or two in the Also Today section over the next couple of weeks. He writes that someone "told me that they think my announcements of my newsletters are not appropriate for a blog."

I have two basic rules for the bloggers (other than treating others with kindness, respect, and so on). Their entries should be of interest to Java developers (though not necessarily on Java specific topics) and no marketing. You could interpret Jack's email as marketing. On the other hand, the bloggers frequently link to articles they found interesting or that they wrote that they hope you will find interesting. I've always looked at Jack's monthly post as an itemized link to articles you may find interesting.

John Mitchell builds on a comment from Sue Spielman's Practical JSTL article. In The "Community" is Always Right? John emphasizes a passage from Sue's article in which she argues why you do not want to be able to perform SQL actions in your JSP pages. Sue writes that even though there are many reasons not to do so and that many members of the expert group agree with her - this functionality is in the final draft because "The community has asked for it, the community has gotten it."

This drove John to his keyboard where he notes that this is another example of the type of "mushed together 'solutions'" that keep many consultants employed fixing "out of control" systems. Join in the discussion of whether a popular vote is a proper way to get a "best solution".

Alan Williamson notes that We have Applets, Servlets and MIDlets, we now need CARlets. With Microsoft's announcement that "hey want a Microsoft OS in every car on Earth!" Alan agrees that there are good reasons for having his car 'net' aware. "It would be kinda of cool to have a Java enabled car.  We'd need a whole new API and no doubt a JSR to head this up.  Maybe we can call it the CARlet.  We can load up our small network aware CARlets that can talk with other car users while we pass them.  Would make sitting in traffic so much more bearable." At the JavaOne Jini showcase a couple of years several car manufacturers showed what they are working on. Alan also points to a Java enabled car and the Chrysler Java.

Today in Projects and Communities, DFUG from the Java User Groups community features a project for "a large proportion of the deaf population in the Federal District of Brazil [who] use cell phones as a means of communication through the exchange of SMS e-mails. [...] ProjectRyben is a J2ME project that transforms spoken words to deaf sign language transmitting them to 3G mobiles. Ryben is the Xavante word for 'communication'."

The Java Communications community is featuring the Leafy project. This API allows you to easily "write a socket-based distributed application that includes non-Java, J2SE, as well as J2ME MIDP 2 nodes on mobile devices such as the Motorola V300 available now in the US from T-Mobile, the Motorola i730 available now from Nextel in the US, and soon the Motorola A760 Linux smart phone [...] or the Sony Ericsson P900, now available in Europe."

In today's News Headlines :

Registered users can submit news items for the href=""> News Page using our
news submission form.
All submissions go through an editorial review by news director Steve
Mallet before being posted to the site. You can also subscribe to the href=""> News RSS

Current and upcoming Java Events:

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission form.
All submissions go through an editorial review before being posted to the

This blog is delivered weekdays as the href="">Java Today RSS
feed. Once this page is no longer featured as the front page of href=""> it will be archived at href=""> You can
access other past issues in the href=""> Archive.