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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Sherlock Holmes Debugging

114 点作者 bqe超过 10 年前

17 条评论

CephalopodMD超过 10 年前
I feel like this developer is trying to present a false dichotomy between his &quot;Sherlock&quot; method of debugging and the scientific debugging method. To be more specific, it seems as though the example he gave exactly fit the definition of the scientific debug method.<p>1. The author identified a problem he wanted to fix<p>2. He tried to guess the cause of the problem<p>3. He tested that guess<p>4. He analyzed the results of multiple trials.<p>5. When he was done with analysis, he worked out a fix and then tested again.<p>The only thing of note to the &quot;Sherlock&quot; method is that the author explicitly decided to spend a great deal of time in the guessing phase. What is my point here? Unless you already have experienced a bug and&#x2F;or know exactly what is causing it right off the bat, the scientific method is still the most effective tool in your debugging arsenal.
评论 #8581713 未加载
huhtenberg超过 10 年前
&gt; <i>I use the Sherlock Holmes method of debugging software. </i><p>Everyone does, surprise! Finding a cause by effect is exactly what the debugging is :)<p>That said, does anyone else remember the &quot;Undo Step Forward&quot; command in TurboPascal 5.5 IDE? You could un-step through the program being debugged, essentially moving back in time. That was an incredible feature, a true engineering curiosity.
评论 #8581034 未加载
评论 #8581122 未加载
评论 #8581253 未加载
bfwi超过 10 年前
This was a nice story about thorough debugging, but I can&#x27;t see how the discovery method is anything different than what most people use.
sargun超过 10 年前
Differential Diagnosis is an excellent approach to debugging. Seeing debugging in the wild before, I&#x27;ve seen two, maybe three different approaches to debugging:<p>1) Magical thinking: This is the fear that the computer system has suddenly changed its mind and decided to stop working. The approach here is typically to try some cargo-cult knowledge on how to fix the system without knowing what&#x27;s wrong, and then just start hitting random things, and see if they come back.<p>2) Panic &#x2F; Fixation: These kinds of developers usually get into a state where they are in a panic over what&#x27;s wrong and fixate on one component of the system where they believe the failure to be. This is slightly more productive than the earlier, but not changing your assessment based on the new information gained is also counterproductive.<p>3) DDX: This is very much the Sherlock &#x2F; House type of debugging. It tends to require a lot of wide-shallow knowledge, as opposed to in depth knowledge of the system. Typically, you work backwards from the symptoms, and essentially do a binary search based on the widest type of problem sets to the narrowest.<p>DDX in-fact is very difficult for most people to do under stress. Nelson from Stripe wrote a post on keeping a notebook to store wide information, and enable caching b-tree searches. This is a very good approach.
评论 #8581990 未加载
fineline超过 10 年前
And if you want to program like Holmes as well...<p><a href="http://www.amazon.com/Elementary-Learning-Program-Computer-Sherlock/dp/B002T6VZJI" rel="nofollow">http:&#x2F;&#x2F;www.amazon.com&#x2F;Elementary-Learning-Program-Computer-S...</a><p>This was the first programming book I read, back in the eighties. Lately I got a copy for nostalgia&#x27;s sake, and it&#x27;s all still spot on good practice today - problem definition, algorithm design, avoiding global state etc - although the language (both the Pascal syntax and the Conan-Doyle-style prose) probably wouldn&#x27;t suit today&#x27;s &quot;Dummy&#x27;s Guide&quot; market.
andrewchambers超过 10 年前
Sometimes I have tried to use the scientific method to resolve hard to reproduce bugs.<p>Write a hypothesis or series of them. Consider what implications this hypothesis would mean about the behaviour of the bug or code. Design an experiment to test the hypothesis, continue with more experiments. List methodology in bug report so others can repeat the experiments. Finally a proof of the cause of the bug is found.
shocks超过 10 年前
I don&#x27;t understand what makes this &quot;Sherlock Holmes&quot; debugging. Don&#x27;t we all do this kind of stuff every day?<p>Cool story though.
评论 #8581179 未加载
hox超过 10 年前
Also known as the &quot;Five-Whys&quot; elsewhere.<p><a href="http://en.wikipedia.org/wiki/5_Whys" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;5_Whys</a>
dfritsch超过 10 年前
Well &quot;Sherlock Holmes Debugging&quot; may be redundant, since this is really just &quot;debugging&quot; (though who would have clicked on that link?), I was most excited by this line:<p>&gt; There is no sin in software engineering more serious than thinking some behavior of a computer system is magical or beyond our understanding.<p>I&#x27;ve been trying to find a good test case to get my junior engineers to step out of their code and see more of the layers. This is a pretty good mantra for improving your debugging skills.
daviddaviddavid超过 10 年前
Only loosely related but for lovers of weird programming texts, there&#x27;s a bizarre gem called &quot;Elementary Basic - Learning To Program Your Computer In Basic With Sherlock Holmes&quot; by Henry Ledgard and Andrew Singer.<p><a href="http://www.amazon.com/Elementary-Chronicled-Learning-Computer-Sherlock/dp/0394524233" rel="nofollow">http:&#x2F;&#x2F;www.amazon.com&#x2F;Elementary-Chronicled-Learning-Compute...</a>
anirudh24seven超过 10 年前
What the article says: Go down the stack in a linear format and check everything<p>What a Sherlock Holmes story is: Seemingly-unrelated characters could be responsible for the crime<p>How the story would&#x27;ve been if it was really similar to Sherlock Holmes:<p>- Check your own software (Already done)<p>- Go down the stack and check all dependency, platform issues (Already done)<p>- Check if your clipboard works properly (New)<p>- Check if the monitor outputs pixels properly (New)<p>- Check if your eyes see clearly (New)<p>That would be Sherlock Holmes debugging!<p>On a serious note, I like the story. I also like the way things are done but I assumed that&#x27;s how every developer works. I looked at the link to the Scientific approach and IMO, that shouldn&#x27;t be considered as the de-facto Scientific approach. This should be the Scientific approach.
xorcist超过 10 年前
MTU problems are not unheard of, it&#x27;s one of the things you always check for whem you have this type of network problems. Especially when you&#x27;re running jumbo frames, which used to be quite troublesome when the technology was new.<p>Another thing to check for is funny-looking TCP flags. Some firewalls tend to drop such traffic, and it may not end up in the logs you usually check.<p>That&#x27;s why the <i>first</i> thing you do when one connection works and one doesn&#x27;t is to tcpdump them and compare. Just last week I had one application which ran ssl directly and in another environment it did a starttls-type thing just because of the underlying libraries.<p>It was immediately obvious from looking at it, but it would have been terribly difficult to guess. Don&#x27;t start with Sherlockian reasoning, start by getting all the data.
rbosinger超过 10 年前
It&#x27;s always bugs like this that end up eating all of your time. That&#x27;s why I find making small client websites or apps (as opposed to larger software projects) to be so hard to profit on.
jheriko超过 10 年前
this is a nice story, but i think something much more important is missed here... application of the scientific method.<p>all of this logical deduction is worthless unless you verify it with experiments. this is very much not what Sherlock Holmes does... but it is exactly what enabled the deduction in the story to be cemented into a reliable conclusion.
chj超过 10 年前
Debugging is detective work.
placeybordeaux超过 10 年前
What a terrible title&#x2F;premise
glibgil超过 10 年前
No shit.