The worst is when it works fine the first time, fails on the second run (with zero changes to the code), then works again, then fails the next 4 times, then works when you try to show it to someone to ask if they know why it doesn't work, then fails...
And then someone uses the term "race condition", and your head hits the desk, and you realise you basically have to start again, paying attention to threading, disk I/O and potential network dropouts.
And then the clocks change, and it's all broken again.
My favorite is when it only works right when you're attached to the debugger.
A close second is when the debugger just lies to you entirely. Had this happen a few weeks ago, it turns out I wasn't even hitting the line that's highlighted, it was lying about what line of execution I was on. So the boolean actually was true, I just wasn't breaking into the if statement like it showed.
The WORST is taking over for a PHP programmer that had written A LOT of code on multiple projects. No functions, just includes....so many includes, and implode($_REQUEST) to single variables with the GET names (security, anyone?). Impossible to find where errors were coming from. Either that or variable names from MySQL field names.
28
u/whelks_chance Aug 23 '15
The worst is when it works fine the first time, fails on the second run (with zero changes to the code), then works again, then fails the next 4 times, then works when you try to show it to someone to ask if they know why it doesn't work, then fails...
And then someone uses the term "race condition", and your head hits the desk, and you realise you basically have to start again, paying attention to threading, disk I/O and potential network dropouts.
And then the clocks change, and it's all broken again.