4 ms·
This is funny, but it's actually more like a programmer's second worst nightmare -- "It doesn't work but it should". The true worst nightmare is, "it works, bu
by SilasX 11y ago
This is funny, but it's actually more like a programmer's second worst nightmare -- "It doesn't work but it should".
The true worst nightmare is, "it works, but it shouldn't", because that means your whole model of the domain was wrong, rather than some isolated, fixable component.
- Natsu 11y agoI remember having one of those moments with a function I hadn't implemented yet and being incredibly confused as to how it could possibly work in spite of there being no code yet.
- moyix 11y agoYes! I once started testing a class I had written, only to discover methods I hadn't finished writing yet were working perfectly! It turns out I was accidentally reimplementing a library function, and I had chosen the exact same names and method signatures for the (admittedly small and fairly obvious) class.
- jacquesm 11y agoHehe, I had more or less the opposite of this once. I spent way too much time tracing a function in ever more detail going on the assumption that it must have been the source of the problem. Only... it was never called in the first place, it was a library module that took the call and it was misbehaving...
- Natsu 11y agoJust for the record, my test was a bit off and wasn't hitting the non-existent code at all.
- nkozyra 11y agoIt's not a nightmare, but it's incomparably frustrating. I'm more motivated to figure out things that work when they shouldn't then the other way around.
- forrestthewoods 11y ago1. That can't happen 2. That doesn't happen on my machine. 3. That shouldn't happen. 4. What does that happen? 5. Oh, I see. 6. How did that ever work? Stage six is the worst. Especially when I wrote the original code. (http://plasmasturm.org/log/6debug/ http://plasmasturm.org/log/6debug/)
- hitekker 11y agoYep, that's a good one! My first time seeing it was on http://bash.org/?950581 http://bash.org/?950581 It comes with a nice follow up after the first 6 rules: < MatthewWilkes> 7. svn blame < miniwark> 8. one day we will write tests
- golergka 11y ago> < MatthewWilkes> 7. svn blame Am I the only one who runs git blame (for the commit, not the author) 20 minutes into investigating the bug and git bisect an hour in? They are excellent tools to find when and how did the bug first occur
- brad0 11y agoI do this as well. Unfortunately we're far and few between.
- klibertp 11y agoIn the "Beautiful Code" book, there is a "Beautiful Debugging" chapter. The author describes how things like `git bisect` work. I had some success convincing people to use bisect at work by pointing them to this chapter.
- babuskov 11y agoYes. And usually discovering answer to 6 leads to finding another bug that would bite you later. So you often spend 2x time finding the answer to 6 than you spent for steps 1-5.
- babuskov 11y ago
- XorNot 11y agoAgreed. There's nothing worse then working on a problem for hours only to have it disappear for no discernible reason.
- hitekker 11y agoThe worst problems ( and the best pranks ) are the ones that make you question your own sanity.