TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why I use a debugger

28 pointsby federicoterziover 3 years ago

12 comments

soyyoover 3 years ago
&gt;&gt;we find stepping through a program less productive than thinking harder and adding output statements and self-checking code at critical places.<p>This ignores the typical scenario where you are working in a business application that you&#x27;ve never seen most of the code, only the relevant parts of whatever tasks you have done in that program, and all of the sudden you are asked to solve a bug or make a change in some place that you didn&#x27;t know even existed, the original developer is long gone, is not documented, and chances are that there are many great coding horrors. A debugger can be really helpful to uncover how that code works.<p>Also it assumes that the only possible use of a debugger is set a breakpoint and then follow every next step until the end, but this is actually not the case. A debugger allows you set conditional breakpoints, skip whole sections of code, evaluate code using the actual context that the application had when it was stopped, make changes to variables while the program is being executed, it is a great tool to explore code and behavior.<p>I respect that some people may not like them and don&#x27;t want to use them, but I find pretty dumb the idea that not using them is superior and you are a worse programmer if you do.
mypastselfover 3 years ago
In my experience, developers who don’t use a debugger belong to one of two groups:<p>1.) Older hacker types for whom it was previously unavailable or difficult to set up, so they learned to work (well) without it.<p>2.) Juniors&#x2F;fresh grads, who often seem intimidated by it, likely because teachers and online resources didn’t emphasize it sufficiently.<p>I think the first group would benefit from introducing a debugger into their work process, but for the second group it should be essential.
评论 #29941716 未加载
sys_64738over 3 years ago
Classic interview question. Tell me about the time you used a debugger to solve a programming issue. Saying &quot;I don&#x27;t use a debugger&quot; is like saying to a C programmer &quot;I don&#x27;t use pointers&quot;.<p>Cut the interview short. Thank them for their time then escort to the exit.
评论 #29933814 未加载
评论 #29933890 未加载
评论 #29933727 未加载
kotxigover 3 years ago
I am surprised to find in these comments that using the debugger routinely and by default isn&#x27;t a popular idea. I couldn&#x27;t do my job as well as I do without having the reflex to use the debugger. I shouldn&#x27;t be surprised though, the last time I watched a coworker roll his face on the keyboard trying to debug something the conversation went something like:<p><pre><code> - Me: Just use the debugger... - Him: But it&#x27;s hard and annoying to use the debugger - Me: It&#x27;s hard and annoying not having the skills or reflex to use the debugger by default - Him: ... ok I agree ... continues rolling face on the keyboard and add print statements everywhere </code></pre> I think much of the sentiment in these comments is sounding like &quot;that&#x27;s not how I work so I will defend myself&quot;. Just learn how to use your debugger and integrate it into your work flow. You don&#x27;t need a special IDE to use a debugger in most languages if that&#x27;s the perceived problem.
评论 #29934267 未加载
评论 #29934446 未加载
cool-RRover 3 years ago
I feel like many of the commenters here haven&#x27;t experienced enough corporate environments. I love using a debugger for open-source projects I work on and web apps I used to do for clients, but when you&#x27;re working for a big company it&#x27;s usually difficult to impossible to attach a debugger. Almost all of them have such convoluted setups that you&#x27;d need to use remote debugging, which is difficult to configure. You can barely use your own IDE in some of the FAANGs. This was the catalyst that made me develop PySnooper.
评论 #29934016 未加载
评论 #29934135 未加载
colesantiagoover 3 years ago
I thought using debuggers was standard practice in non trivial programs?
评论 #29933593 未加载
评论 #29933250 未加载
评论 #29933629 未加载
评论 #29933260 未加载
评论 #29933681 未加载
评论 #29933327 未加载
评论 #29934154 未加载
the-alt-oneover 3 years ago
How quickly do you guys whip out the debugger when you encounter a bug?<p>I often can figure it out by reading the code (I&#x27;m the quickest jump-to-source in the wild west!) quicker than I can from inserting print stmts or hooking up a debugger.<p>I&#x27;ve also decided that I dislike having my IDE be my debugger, I prefer having an entirely separate UI for that. Maybe this is because I use Emacs and DAP mode and gdb is quite poor there, I&#x27;d rather use something like gdbgui.
评论 #29933673 未加载
评论 #29933703 未加载
评论 #29933916 未加载
评论 #29933652 未加载
glandiumover 3 years ago
There are cases where I use print debugging in Firefox because it&#x27;s ironically often faster to rebuild and rerun than for gdb to load the debug info. Also for rust, it can be much more convenient to use the dbg! macro for pretty printing rather than dig in the mess of values in the debugger.
willciprianoover 3 years ago
On one of Gordon Ramsey&#x27;s shows he had a chef who purported to be one of the best in the world. While cooking his scallops kept sticking to the pan, this makes them look bad and Gordon won&#x27;t serve them looking like that. Gordon yelled something like &quot;Why aren&#x27;t you using the non-stick pans, it&#x27;s right there in the name, non-stick&quot;. I hear his voice in my head at least once a month when one of the people I work with spends a week on a bug and never once whips out a debugger. It&#x27;s right there in the name guys.
评论 #29933560 未加载
评论 #29933716 未加载
评论 #29933778 未加载
评论 #29933902 未加载
评论 #29934075 未加载
mtVesselover 3 years ago
When I write code that has multiple, interrelated parts, before I ever run it I step through it in the debugger to verify that my logic is correct, I didn&#x27;t make any off-by-one errors, library calls return what I expect, etc.<p>I especially do this when the code has destructive side-effects (a file gets moved&#x2F;deleted, a database get updated, whatever), so I can skip over any external actions I don&#x27;t actually want to occur until I&#x27;m ready for a full test run.<p>Everybody does this, right? Right???
评论 #29934512 未加载
评论 #29935030 未加载
mule1over 3 years ago
Wait..... There are people who don&#x27;t use debuggers that are readily available for compiled languages?
georgewsingerover 3 years ago
I look forward to seeing the author write about Pernos.co, an <i>extremely underrated</i> debugging tool that basically changed my and my team&#x27;s lives when fixing bad code.