Too Long; Didn't Read
When dealing with untested or legacy code refactoring is dangerous and tests can help us do it the right way. Test Driven Refactoring (TDR) is different from TDD, but the two are closely related. In this post I want to show you how you can safely refactor such a class using tests. The effectiveness of this methodology depends strongly on the quality of the tests themselves, possibly more than when developing with TDD. As you will be able to infer from the final result, there is no reason to keep an object-oriented approach for this code.