Refactoring Legacy Code ●
Replace “includes” –
Search for left over includes
–
If in current class
–
46
1
Copy contents into file directly
2
Refactor for: no globals, no ‘new’, DI, return instead of output, no includes
More often 1
Copy contents of include as-is to new class method
2
Replace with in-line instantiation
3
Search for other uses of same, and update them as well
4
Delete original include file, regression test
–
Test, create new tests if needed
–
Repeat