by galoisscobi · 4y ago · 0 comments
Also, do you have any plugin recommendations for debugging?
Granted, I get it, you didn't design the thing but you still need to debug it so no judgement, just more of an observation that if you limit yourself to simple tooling you might be surprised at how the pain points will force you to spend more time thinking about how to design your own code to be more simple and that's bound to have a far greater impact than any debugging tool could provide you.
With a debugger you can also change the behavior of a live program, e.g. modify variables or jump over a piece of code that would otherwise be executed.
Every person I've encountered professionally who either "doesn't use debuggers" or thinks "print statements are better" seems to be under the mistaken impression that all a debugger is good for is stepping through code.
Debuggers are fantastic tools. You should re-evaluate your view of debuggers and you will become a better programmer.
I think they have their place as tools but largely that's dwarfed by other practices. In the notion of systems thinking, I try to limit the scenarios where needing a debugger is seen as the natural extension. This means having tests, practicing type-driven design, mapping my APIs to some real-world model (and knowing where that fails or falls short), using languages that obviate the existence of certain classes of bugs (e.g. Rust, languages with a GC), etc.
Sometimes you're trying to inspect behaviour that changes in the moment, and debuggers do great there. However, I'll say that some of the most interesting bugs I've dealt with were only visible in release builds with no debug symbols, so my debugger didn't do much of anything for me there.
Plus, this doesn't even dig into other tools that _aren't_ taught because people reach for their debuggers. How many of the folks grabbing debuggers every day have been given the same speech / sentiment given to toolz above about strace? valgrind / address sanitizer? thread sanitizer? syslog?
I feel like this comment might be a bit rambly, but I was hoping to expound on what toolz mentioned above -- there's a lot of ways to crack an egg here and the debugger is something I almost never reach for.
Vimspector isn't nearly as friendly as vscode but the which-key plugin jogs my memory on the key bindings pretty fast.