by gbuk2013 · 1y ago · 0 comments
Funnily enough I did once fix a bug through refactoring. IIRC it was some intermittent race condition in some async code that I just couldn’t figure out, so I rewrote the code to do the same thing but simpler and the problem disappeared. I was too tired and relieved to continue figuring it out why it was originally broken.
I get nervous about things that accidentally work but I definitely relate to being so tired or under too much pressure to move on that I just trust in luck.
That said, I would guess that even if the accidental behaviour change didn't occur, the bug would have been much easier to solve after the refactor made the intention of the code clearer.