Comments by "MrAbrazildo" (@MrAbrazildo) on "The Real 10x Engineer" video.
-
7:25, I once made a nasty bug by refactoring 4 lines / 2 cmds to 1 line / 1 cmd. They were all made by ternary operators, nested or not. I mentally checked "every" possible case. It ended up being correct in 6 of 8 cases, as long as I remember. It was hard to catch, because 1) it was hard to made it appear (seldom seeing, but never gone), 2) it appeared after tons of things happened (reproducing its scenario could produce a false positive, regarding to its source) , 3) and I had a false lead/clue, which took a time to realize that. Hard to test, happen and promising false clues.
Automated tests would catch that right at its birth. But there's a question that doesn't want to silence: if automated tests are necessary for every bit of refactoring, would them in the end taking more time than catching a bug when it finally happen?
1