3 ms·
I agree that rewriting is riskier, but refactoring the function to make it testable can indeed introduce bugs. The thing is that you'd never be sure of it, sinc
by imiric 2y ago
I agree that rewriting is riskier, but refactoring the function to make it testable can indeed introduce bugs. The thing is that you'd never be sure of it, since you don't have tests to prove how it should've worked initially. I mean, if the function is trivial, it's easier to change it without affecting its behavior, but sometimes this is not the case. So having _some_ tests, even if they're not unit tests, makes this a bit safer.