Big Refactoring Problem
Posted: Mon Sep 18, 2006 5:37 pm
Situation:
Does anybody know the name of any (specific if possible) technique I can research to provide a solution to this or have a solution of their own?
- I have a large body of code
- Said code is desperately in need of refactoring
- Said code is incomplete and only partially tested.
- Existing tests are not isolated or independent. One instance of this is where I have three classes OF_TextSmall, OF_TextLarge and OF_Password they each share FOUR abstract classes so those four abstract classes have only tested in the unit test for OF_TextSmall.
- Complete all tests so that all functionality overall is tested and fix bugs where necessary. Green bar.
- Isolate tests so that I can prove that each and every class has all of the functionality it is supposed to and, where reasonable, none of the functionality it is not supposed to. Green bar.
- Piece by piece alter tests to support new refactorings. Red bar.
- Carry out refactorings. Green bar.
- If I obey step number two I will likely end up with one hell of a lot of duplicated tests. For instance I would have to change the tests for OF_TextLarge and OF_Password to be equally comprehensive as OF_TextSmall.
- To update all the tests to prove where code should be refactored would be a big job and I'm likely to miss things.
Does anybody know the name of any (specific if possible) technique I can research to provide a solution to this or have a solution of their own?