2 ms·
> If we’re embarking on a change that is not really refactoring (for example looking at a bug or an adjustment after a third party change), we can’t fix it with
by gbuk2013 2y ago
> If we’re embarking on a change that is not really refactoring (for example looking at a bug or an adjustment after a third party change), we can’t fix it with refactoring.
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.
- TiredGuy 2y agoSame. Sometimes the best way to fix a bug is to refactor it out of existence.
- Salgat 2y agoAnd if you're lucky a new hidden bug appears.
- zingar 2y agoI suppose theoretically this must have been behaviour change that crept in with the refactoring, that luckily had a good result and not a bad one. 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.