Thursday 31 May 2012

A Refactoring Experience.

Often when you are faced with a big refactor, removing a property in a class which is used many places in your code, it seems that the quickest way to go about it, is to simply delete the property and correct all the errors that the compiler finds. This poses a problem however, because you will put all your code in a long state of limbo where you change code, and are not able to to compile and test your changes. If you like me is a bit of a test driven developer, it hurts not to be able to see the green bar for hours. Often these changes also drives other changes, which you might start implementing also, pushing your code even further out in no mans land.

A much better way of going about it is to use the IDE common feature “Usages of”, and then go through the each of the refactorings one by one. Depending on how big they are, you can do build->test at different intervals. even check your code in midway, since it is all building and goes green bar.