Live data from Hacker News

Ask HN: Why are we not using debuggers more?

news.ycombinator.com

1–10 of 48 posts

Ask HN: Why are we not using debuggers more?

#1
I noticed that I rarely use debuggers. I asked around, and most of my co-workers are the same. We rely on debuggers only as a last resort, instead opting for prints, asserts, or the "method of the long stare". We are developing in Python/Java/C++ and use other convenience tools like IDEs.

Are you also avoiding debuggers? If so, why? What makes debugging so tedious?

Re: Ask HN: Why are we not using debuggers more?

#3
post #2

Because developers are deathly allergic to understanding/reading other people's code, and/or do not write them for t. Grumpy maintainer

I don't think I understand. Are you saying that debuggers have no use on your own code, and people avoid looking at other people's code? Also, are you saying that there exists no debugger for ?

Re: Ask HN: Why are we not using debuggers more?

#4
Some ideas:

First, if you can fix most issues with a glance or a brief stare, using a debugger never really feels necessary. It may also feel less like using your own brain and solving a puzzle, and puzzle-solving is a huge part of human psychology (see post title).

Also, the story of the last N years has been the text editor, not the IDE. The IDE and its world is really where the integrated debugging story is a big deal.

But if you are using a text editor--or text editors--integrating debugging is less of a thing. Your time may be better spent with various productivity-focused changes for ergonomics, like studying or changing keyboard shortcuts, installing or writing plugins, setting up your own scaffolding using system tools integration, and so on.

Plus once you know the various shortcuts, it's maybe more fun to use them and zip around adding prints than it is to debug. You also gain practice this way, after all.

But if you moved from text editors to IDEs, IMO you probably brought that same set of practices along.

Anyway, good q, I've thought about this recently as well.

Re: Ask HN: Why are we not using debuggers more?

#5
I'm getting more into using debuggers lately. They can really help they just take time to learn.

As to why they are a last resort. For me it was just having to learn the debugger and also setting up the debugging environment. For every binary needs to be built with debugging symbols and any libraries you're wanting to step through you have to find the symbols for those too.

Also I think it depends on how low level the language and what kind of program it is.

Some languages/environment don't have debuggers or they aren't very good. I wouldn't say most debuggers that are mature are super great to use either.

Re: Ask HN: Why are we not using debuggers more?

#6
For me debuggers are the first resort. I learned a long time ago that if you get in the habit of hacking the code to debug it (say adding print statements) you will eventually check in debug-related changes that you shouldn't. Using the debugger means you don't have to hack the source code.

I use Jetbrains tools and have an easy time debugging in Java, Python and Javascript. In Java I'd say that you can use unit tests to interactively experiment the same way people do with the CLI in Python with the difference that you get unit tests out of the deal as opposed to having lines scroll away in the console.

I use WebStorm to debug Javascript programs that run in npm but if it is running in the browser I just use the "developer tools" from Firefox, Chrome, Edge or Safari. I think there is some way to attach WebStorm to a running web browser but I've never figured it completely out.

I think the Unix culture is allergic to debugging. It's not that hard to use gdb from the command line and in fact you can do some pretty awesome things with it such as embedded system debugging or debugging the C++ and Java sides of an application at the same time, but for a long time I kept trying graphical front ends for gdb such as ddd that "just don't work".

Re: Ask HN: Why are we not using debuggers more?

#7
Debuggers don't give you enough information when you want more, and too much information when you want less.

Learning and effectively using a debugger can require as much cognitive load as programming itself.

Given that, using a debugger takes you out of your programming mindset and into debugger mindset. Using prints, asserts, etc. keeps you in programming mindset, so you can find and fix the problem and get back to coding without the need for cognitive gearshifting.

Re: Ask HN: Why are we not using debuggers more?

#8
When build times are short, spinning up a debugger is overkill compared to adding a couple of debug statements.

The code I write is also a lot more asynchronous nowadays, and debuggers are fairly worthless for async code imo. Pausing on a breakpoint conceals issues with asynchronous timing that good logging will show immediately.

I still believe debuggers should be a part of every developers toolkit, but like anything else, pick the tool for the job and sometimes print statements are just the easiest and fastest. Actually in a lot of cases.

Re: Ask HN: Why are we not using debuggers more?

#9
I love using the debugger but now I want one where I can rewind the program a few steps if I want to. The use case I have is to go back and forth trying out different combinations of variables on a section of code. Even if I could manually set a flag to store the program state at certain portions so I can return there, that would work great.

Other than that, debuggers are very superior to print statements and such. You can’t pause a print statement and inspect the objects you didn’t print!

Re: Ask HN: Why are we not using debuggers more?

#10
post #7

Debuggers don't give you enough information when you want more, and too much information when you want less. Learning and effectively using a debugger can require as much cognitive load as programming itself. Given that, using a debugger takes you out of your programming mindset and into debugger mindset. Using prints, asserts, etc. keeps you in programming mindset, so you can find and fix the problem and get back to…

What kind of information would help you to debug? And what kind of information is "too much"?

Personally, I think "too much" is when you get a large table of all variables and their values; it is quite hard to locate the one you care about...

Post reply on HN