Hacker News new | ask | show | jobs
by tootie 2600 days ago
I find this to be completely unbelievable. If I'm in IntelliJ or Visual Studio, then adding breakpoints is equivalent, but easier than adding print statements. It's trivial to click the gutter on the line I'm suspicious of and run the program in debug mode. I can see all the local vars (exactly what I'd do with a print statement) and if something is amiss, easily go back up the call stack to see what went wrong. I find it mind-blowing when developers don't do this because it's so easy and so valuable. It's just so much harder to do with functional languages or languages without a first-rate IDE which seem to be what people like these days. In fact, I find it mind-blowing when developers don't consider this a mandatory feature to need when choosing a language.
2 comments

Visual Studio's debugger is especially magical with .NET. With the debugger paused on a breakpoint you can drag the "next statement" pointer backwards to rerun pieces of your code. You can also edit the code while paused and your changes will be reloaded on the fly when you continue execution.
> you can drag the "next statement" pointer backwards to rerun pieces of your code.

Works also in C++, though not very well when the debugger stops on an exception.

Furthermore, you can even edit the values in place, to confirm or reject your hypothesis about a bug. And a debugger can often reach into framework or library code as well, saving the need to go and check out and rebuild dependencies.