3 ms·
I would establish some tests for the code first. Then I would look for chunks of code I could break out into their own functions and break it out. Next I woul
by tmaly 4y ago
I would establish some tests for the code first.
Then I would look for chunks of code I could break out into their own functions and break it out.
Next I would write some tests for those smaller functions.
Finally I would test the new function calling the smaller functions with the tests used against the original.
Depending on the complexity of the original function, you may have to write more tests.