TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

I do not use a debugger

41 点作者 another将近 9 年前

16 条评论

corysama将近 9 年前
There are two areas I repeatedly see people touting that don&#x27;t use a debugger.<p>1) Situations where debuggers are completely unable to be of any help. Such as debugging distributed messaging.<p>2) Situations where someone is refining an specific piece of software for so long that they have every aspect of the code worn deep into their memory.<p>1 is pretty common in web development and web developers talk a lot, so you hear a lot of people talking about it. 2 is something you only hear about from highly respected developers working on highly respected projects. That gives the impression that it&#x27;s something respectable people do.<p>Unfortunately, 2 is not a situation that most people are in. In my experience, most people work in projects that involve too many people changing too much stuff too fast to burn anything into memory. These projects probably won&#x27;t survive more than a few years. And, if the resumes I see are any indication, most people won&#x27;t stick around on any company -let alone project- for more than a few years.<p>For the majority of people, powerful debuggers can be tremendously valuable. The two biggest issue blocking that value are 1) many development environments have pitiful-if-any debugging support and 2) a lot of developers react to their crappy debugger situation by assuming debuggers in general are crap and that developers should be macho enough to not need them.
评论 #11950348 未加载
zbuf将近 9 年前
Hmm, this headline is bought to you from the &quot;too cool for school&quot; crowd.<p>The citations in the article are a little flawed to support the argument. Torvalds &quot;doesn&#x27;t use a debugger&quot;, except the actual quote contains &quot;I don&#x27;t like debuggers. Never have, probably never will. I use gdb all the time&quot;<p>Guido van Rossan &quot;uses print statements for 90% of his debugging&quot;.<p>Sounds like people who &#x2F;are&#x2F; using debuggers to me.<p>In fact, using one for the remaining 10% of the bugs sounds about right. I&#x27;d be highly sceptical of any programmer who has not picked up a debugger in the last year, and using it to step through some code is just one of it&#x27;s many features.<p>But this article could easily be headlined &quot;people don&#x27;t use debuggers all of the time&quot; and it wouldn&#x27;t be nearly as interesting.
Arzh将近 9 年前
&gt; If you dive into the bug, you tend to fix the local issue in the code, but if you think about the bug first, how the bug came to be, you often find and correct a higher-level problem in the code that will improve the design and prevent further bugs. -- Rob Pike<p>I&#x27;m usually not allowed to fix bugs in that manner since there is a false sense of risk to go along with it. That being said, when I do work in games a debugger is essential, stepping through the code and watching the vars change is needed since most of the code is a simulation and you can&#x27;t just &#x2F;think&#x2F; the problem away.
dang将近 9 年前
I wrote an Emacs mode that interfaced to V8&#x27;s debugger so I could single-step through the Lisp (Parenscript) programs we were writing that compiled to JS. In the end I only used it a handful of times over three years. That was a lot of work for something one doesn&#x27;t end up using! (Though it was still a good learning exercise.) Writing your own debugger and then never using it turns out to be pretty strong evidence that you don&#x27;t need one.
cbanek将近 9 年前
While I used to like debuggers, recently I&#x27;ve found them to be a giant pain.<p>First, process boundaries. If you&#x27;re using a complicated stack, it&#x27;s likely that you&#x27;ll need to set up multiple debuggers for different processes and switch between them.<p>Second, languages. If you&#x27;re using different languages, or a combination of languages, debuggers can be very painful. Each usually has a settings overhead per project for finding source code files, etc.<p>Some bugs just don&#x27;t reproduce in debuggers, anything with multithreading or timing is instantly troublesome.<p>Also, in production, you rarely have the option of a hooking up a debugger to a live service. By not relying on the debugger up to this point, you hopefully have a robust logging system that can be configured to give you the detail you want at the time. The messages will hopefully be informed by previous debugging sessions, and help get you to your solution more quickly.
selectnull将近 9 年前
&gt; If you dive into the bug, you tend to fix the local issue in the code, but if you think about the bug first, how the bug came to be, you often find and correct a higher-level problem in the code that will improve the design and prevent further bugs. -- Rob Pike<p>Sometimes, the bug is local. And in those times, debugger is excellent tool.
jcrben将近 9 年前
Most applications branch based upon their state. You can&#x27;t just statically analyze them without knowing that state. OK, so you can add print statements to get a small peek into the state. But if you have a moderately complex application with multiple branches, you&#x27;ll need to keep adding these to even know where to point your next print statement. That&#x27;s a rather tedious feedback loop.<p>Functional programming does make your code more statically understandable, but it&#x27;s not going to remove branching. So I guess you memorize all the inputs? Do you write them down? Might be easy if you have a simple program under your own control, but not when business requirements impose a wide array of inputs, and some of those inputs are different than you expect (hence, the bug).<p>It&#x27;s also enjoyable to drop into a REPL (read-evaluate-print-loop) at some interesting point. At that point you can try all sorts of things with no friction. Minimize your feedback loop.<p>It&#x27;s funny how Lisp was famous for its REPL, and yet now we&#x27;re in the 21st century and some people think they&#x27;re too cool to use a REPL.<p>As for me, I&#x27;m enjoying Redux style time-traveling debuggers... in the future rather than tedious print-&gt;run or step slowly we may just query the state of a program over time like a database.
draw_down将近 9 年前
I don&#x27;t really think using a debugger is incompatible with the advice here, but, whatever. Knock yourself out if you don&#x27;t wanna use one.
nickpsecurity将近 9 年前
The links actually had the counterpoints I was going to make: hardware-level issues like device interactions and memory corruption. You&#x27;re not going to figure those out just looking at source code. You need to see how the live value got inappropriately transformed by something that had no business transforming it. That said, the small counterpoints support the consensus in the links that debuggers could be relegated to a rare tool you break out rather than essential part of development. I&#x27;m personally undecided on the issue.<p>Whereas, I encourage Design-by-Contract interface checks, strong typing, and static analysis over TDD. You can use them in conjunction but you knock out more bugs with the former. Plus encode the assumptions in a simple way. Even better, what you knock out applies to all cases within the spec instead of what specific ones you thought to test.
评论 #11949797 未加载
voycey将近 9 年前
In every language I learnt in my CS degree, the debugger was integral. One of the first things you are taught in CS is how to use truth tables to determine the expected outcome, debuggers are just an extension of the whole &quot;I expect this to be x value&quot; - In my development now I see it as just as integral and it takes me a fraction of the time to track down a bug as it does the developers on my team who don&#x27;t.<p>Obviously each to their own - but when I see one of my team putting print statements after every line and constantly going back in to run the code it drives me mad - 90% of the time you can sort it out in 1 pass with a debugger.
peterkshultz将近 9 年前
When first learning to program, my teacher refused to allow us to use the debugger. He believed it corrupted our abilities to truly understand the code that we wrote.<p>Although I now use a debugger, I can&#x27;t help but feel improper for having abandoned his rule. While a debugger provides for an easier programming experience, there is something to be said for personally combing through every line of code to find a bug.
评论 #11949341 未加载
评论 #11950143 未加载
barefootcoder将近 9 年前
This is very similar to a POV that I&#x27;ve espoused for quite some time, though I phrase it somewhat differently.<p>A symbolic debugger is good for verifying your premises, but the actual troubleshooting should be done by thinking about the problem, thinking about the code, forming a hypothesis about the potential causes of failure, then confirming (using a debugger as necessary). Too many young and inexperienced developers fall into the trap of running straight to setting a breakpoint and watching what happens, which doesn&#x27;t scale to more difficult problems such as concurrency and IPC.<p>I find myself using a debugger when:<p>1) it&#x27;s a trivially 100% reproducible problem 2) it&#x27;s a completely new codebase that I&#x27;m unfamiliar with 3) it&#x27;s a language that I&#x27;m unfamiliar with<p>Otherwise the only reason I use it (or print&#x2F;log statements) is, as stated, to verify the premises upon which I am basing my reasoning about the likely causes.
xg15将近 9 年前
The main arguments of the author seem to be &quot;I don&#x27;t use a debugger&quot;, &quot;Some people I respect don&#x27;t use a debugger&quot;, &quot;sometimes you can&#x27;t use a debugger&quot; and &quot;we should make tools that are somehow better than debuggers&quot;. I don&#x27;t find any of those very convincing.
mixedCase将近 9 年前
A debugger is a very convenient tool when dealing with spaghetti code.<p>Which also has the side effect of allowing undisciplined&#x2F;inexperienced programmers to more easily churn out spaghetti code.<p>I very seldomly use one, almost always if I know it&#x27;s gonna save me <i>a lot</i> of time. And I would certainly never recommmend a beginner programmer to learn how to use a debugger until he gets very deep in the shit. Before that point though, his&#x2F;her own human resourcefulness and introducing a little knowledge of best practices will set him&#x2F;her on the right path faster than a debugger will.
6mirrors将近 9 年前
I don&#x27;t care
mehh将近 9 年前
Is this really still a debate?<p>If using tool helps, use the damn tool.<p>Each project is different, there isn&#x27;t a golden rule for this shit arghhh.<p>You might not need to use a debugger often, but number of times I have seen a young dev too cool (or lazy to learn&#x2F;configure) for a debugger waste time poking about making random guesses, when a simple break point would of told them the problem in a couple of seconds. Literally seen them waste hours inventing all sorts of improbable reasons why it doesn&#x27;t work.<p>I don&#x27;t use a debugger very often, but I have been programming a long time and hit my head on so many bugs I can make very good predictions where an issue might be. That takes time, tying to emulate very experienced people when your not is foolhardy.
评论 #11949841 未加载