3 ms·
The worst bug I ever introduced was when refactoring duplicate code. I was refactoring handling of dates. The code was littered with date handling that was not
by surfsvammel 7y ago
The worst bug I ever introduced was when refactoring duplicate code.
I was refactoring handling of dates. The code was littered with date handling that was not thread safe and duplicated all over the place. So. I made it thread safe and pull it all out into a central place. But while doing so I accidentally introduced a new bug that then hit every single time dates where being handled. Which was all the time. Several thousand times per minute.
Oh my. The cleaning up we had t do after that.
The lessons I learned was: 1. Don’t be so eager to refactor code.
2. If you refactor repeated code you are introducing a single point of failure. Make sure it works.