News for hackers. Stuff that matters.
Re:The Timeless 9 Golden Rules of Debugging by heikkilevanto on Monday January 13, 2025 @08:30AM (#42683211)
Some additional rules: - "It is your own fault". Always suspect your code changes before anything else. It can be a compiler bug or even a hardware error, but those are very rare. - "When you find a bug, go back hunt down its family and friends". Think where else the same kind of thing could have happened, and check those. - "Optimize for the user first, the maintenance programmer second, and last if at all for the computer".
Re:The Timeless 9 Golden Rules of Debugging by wormlord on Monday January 13, 2025 @10:33AM (#42684520)
I always have the mindset of "its my fault". My Linux workstation constantly crashing because of the i9-13900k in it was honestly humiliating. Was very relieved when I realized it was the CPU and not some impossible to find code error.
Re:The Timeless 9 Golden Rules of Debugging by dehrmann on Monday January 13, 2025 @12:43PM (#42686167)
Linux is like an abusive relationship in that way--it's always your fault.
Re:The Timeless 9 Golden Rules of Debugging by ajuc on Monday January 13, 2025 @09:03AM (#42683500)
It's healthier to assume your code is wrong than otherwise. But it's best to simply bisect the cause-effect chain a few more times and be sure.
Re:The Timeless 9 Golden Rules of Debugging by physicles on Monday January 13, 2025 @01:15PM (#42686533)
The first one is known in the Pragmatic Programmer as “select isn’t broken.” Summarized at https://blog.codinghorror.com/the-first-rule-of-programming-...
Re:The Timeless 9 Golden Rules of Debugging by bsammon on Monday January 13, 2025 @01:59PM (#42687169)
Alternatively, I've found the "Maybe it's a bug. I'll try an make a test case I can report on the mailing list" approach useful at times.

Usually, in the process of reducing my error-generating code down to a simpler case, I find the bug in my logic. I've been fortunate that heisenbugs have been rare.

Once or twice, I have ended up with something to report to the devs. Generally, those were libraries (probably from sourceforge/github) with only a few hundred or less users that did not get a lot of testing.

Re:The Timeless 9 Golden Rules of Debugging by astrobe_ on Monday January 13, 2025 @02:02PM (#42687226)
About "family and friends", a couple of times by fixing minor and a priori unrelated side issues, it revealed the bug I was after.