4 ms·
This conjures up the memory of articles talking about why syntax highlighting is bad. [1] It's sort of funny that the author even admits "Ok, well, I do use a
by cogman10 3y ago
This conjures up the memory of articles talking about why syntax highlighting is bad. [1]
It's sort of funny that the author even admits "Ok, well, I do use a debugger but only when it makes sense". Like, are there devs using debuggers when they don't make sense? I don't often drop into a debugger just for fun.
Debuggers (and, particularly the java debugger) are amazing tools for quickly figuring out why things went wrong. I rarely step through code (though sometimes that's useful) but I frequently will drop a breakpoint on an exception and then jump around the call stack to see exactly how a particular exception developed. With a debugger, I get all the inputs for everything up and down the stack. I can pop the stack and replay the exception over and over again. I can evaluate code in the current scope to test and see what's going wrong.
Particularly with really complex software stacks, debuggers are essential.
Consider, for example, this error case I ran into.
Some code took a view on a map. Unfortunately for us, modifications to that view are both allowed AND mutated the underlying map. When the code that produced that view called other code, at about 30 layers down some code said "If there's not a value here, add the value 0". This caused the unusual state where with apparently the same input data when you first called a method, it would pass no problem. The second time, it would error out.
How on earth would you discover this behavior without a debugger? The root method where this all happened was already 20 layers deep in this fairly complicated piece of software (yay finance!). A simple unit test would show everything working as expected, it's not until that second run of the same code that things blew up.
Without actually catching the fact that the inputs were mutated from an earlier invocation there's really no way to know what went wrong. A debugger made that obvious.
[1] http://www.linusakesson.net/programming/syntaxhighlighting/ http://www.linusakesson.net/programming/syntaxhighlighting/
- shortcake27 3y ago> Like, are there devs using debuggers when they don't make sense? I don't often drop into a debugger just for fun. Yes. Older developers tend to debug with console/echo/print etc. Somewhere along the line this was deemed “bad practice” and now there are devs who will exclusively use the debugger for everything because they were taught it’s the “correct” way. People will do what they’re taught. I grew up with console/echo/print so that’s how I roll. I never use the debugger, to my detriment. Conversely, people who grew up exclusively using the debugger will use the debugger for everything even when it would be way faster to just dump some data.
- wizofaus 3y agoI learned to program, even in assembly, before quality debugging tools were available (or I knew about their existence), so very much relied on "debug manually using log output". But once proper debuggers were a thing and I learned how to use them I never looked back. In fact I often use debuggers to step through new (or new-to-me) code even if it does appear to be producing the right output as I've seen too many times there are bits of unexpected behaviour along the way that are virtually guaranteed to cause a problem at some point (including cases where errors were occurring but being swallowed/ignored).