Ask HN: Do You Use a Debugger?
I saw an interview with John Carmack in which he remarked that game developers and PC users more often use debuggers, but going into an industry with more Linux and Mac users, they pride themselves on the purity of not using IDEs or debuggers
It seems odd to me, but I also noticed a lot of my coworkers don't use the debugger in vscode or even the browser when I've shown them how. They opt instead to put console.log statements everywhere
Do you use a debugger or breakpoints? How common is it in your workplace for people to debug things the old school way and prefer plain text editors over IDEs?
39 comments
[ 3.4 ms ] story [ 104 ms ] threadint age = will never have string "December".
But in python both: age = 42 and age = "December" are possible.
VSCode debugger is pretty useful with a GUI and the ability to set up conditional breakpoint.
Perhaps if you work on very small projects
In some languages it is so easy, that you don't even have to use an IDE. Let's talk about JavaScript / TypeScript... you could use the browser developer tools to set break points, but for transpiled projects with boilerplate you can also use the `debugger` statement to hardcode a breakpoint.
I wish they would take it one step further and integrate the timeless debugging[1] concept everywhere, where you could step forward bug also backwards.1: https://www.youtube.com/watch?v=eGl6kpSajag
Normally I just sprinkle lots of logging statements around, which tell what is going on and when that occurs, and building a bigger picture of what's happening in the program.
I also turn on as many warnings as possible with the compiler. Fixing those warnings as they appear prevents lots of shit later in the development process.
Debugging is so useful as a tool. There is nothing like it. They help a lot when there is complex state being manipulated. Instead of writing print statements, recompiling, repeat, debugging enables seeing everything, computing watch statements, deeply inspecting objects wherever you are and so much more. The biggest thing it enables is near-0 cost hypothesis testing when debugging.
Editing code at fly and moving program's current executing code ahead or behind is really handy, even for development purpose!
(yeah yeah yeah, I think gdb has a tui mode now and the emacs debugger mode can probably do all that, solve world peace, and cook me an omelet).
I'm lazy, so if I have to do a lot of work to run the debugger, I don't.
First choice is to look at the code and reason it out. Then throw some printfs in. Third time's a charm, so that's when I reach for the debugger.
Not using IDEs isn't a bad thing, VIM is infinity customizable and you can setup your own work flow.
Logs are useful when reproducing the issue is complicated or having no access to source code. Usually related to timing sensitive issues with systems that communicate with each other.
And long ago the Microfocus "animator" saved our bacon when a Peoplesoft COBOL program was blowing up mysteriously and blocking implementation.
I'm not sure I'd count the browser console as a debugger, but I do use it from time to time.