Ask HN: Do You Use a Debugger?
18 points| shortrounddev2 | 2 years ago | reply
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?
[+] [-] ksherlock|2 years ago|reply
(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.
[+] [-] sandreas|2 years ago|reply
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
[+] [-] wojciii|2 years ago|reply
[+] [-] wruza|2 years ago|reply
In general I think that logs and debuggers aren’t enemies. A debugger helps with exploration in a specific moment or catching a specific condition or access. Debug logs help with matching expectations about a whole process. But both can do both.
Also, when I’m writing a service, I always write detailed operation logs. Saves your butt when something “costed us money” happened three days ago and you have to explain why. These never get turned off, regardless.
[+] [-] unknown|2 years ago|reply
[deleted]
[+] [-] retrac|2 years ago|reply
[+] [-] shortrounddev2|2 years ago|reply
[+] [-] parentheses|2 years ago|reply
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.
[+] [-] shortrounddev2|2 years ago|reply
[+] [-] neilsimp1|2 years ago|reply
When I was first learning PHP I spent a year or two without a debugger. The first time I tried one I learned about a whole bunch of global variables I had no idea about.
I recently set up nvim-dap and have wonderful debugging experience while still in the "purity of not using IDEs or debuggers" realm.
[+] [-] cafard|2 years ago|reply
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.
[+] [-] hnaccountme|2 years ago|reply
Not using IDEs isn't a bad thing, VIM is infinity customizable and you can setup your own work flow.
[+] [-] simonblack|2 years ago|reply
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.
[+] [-] iExploder|2 years ago|reply
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.
[+] [-] hnthrowaway0328|2 years ago|reply
VSCode debugger is pretty useful with a GUI and the ability to set up conditional breakpoint.
[+] [-] kkoste|2 years ago|reply
There are however good videos out there for learning it.
But the people I've worked with used either use emacs, notepad++, vscode, or gdbgui to debug code.
[+] [-] tester756|2 years ago|reply
Editing code at fly and moving program's current executing code ahead or behind is really handy, even for development purpose!
[+] [-] fragmede|2 years ago|reply
[+] [-] haltcatchfire|2 years ago|reply
[+] [-] NikkiA|2 years ago|reply
[+] [-] Havoc|2 years ago|reply
[+] [-] cachecrab|2 years ago|reply
[+] [-] novagameco|2 years ago|reply