IHME Tech
Published in

IHME Tech

Walking the Tightrope: 8 Tips for Refactoring an Active Application

If you are a developer who has been asked to rapidly implement new features in a heavily-used application — whose codebase is in various states of broken | unreadable | inefficient — you’re in a tough spot. Here are 8 tips (that I’ve learned the hard way) for walking the refactor tightrope.

“When you find you have to add a feature to a program, and the program’s code is not structured in a convenient way to add the feature, first refactor the program to make it easy to add the feature, then add the feature.” ~Martin Fowler

“You might want to explain this principle to the boss by using a medical analogy: think of the code that needs refactoring as a ‘growth.’ Removing it requires invasive surgery. You can go in now, and take it out while it is still small. Or, you could wait while it grows and spreads — but removing it then will be both more expensive and more dangerous. Wait even longer, and you may lose the patient entirely” ~Andrew Hunt, David Thomas

“Refactoring changes the program in small steps. If you make a mistake, it is easy to find the bug.” ~Martin Fowler. Yes. Martin Fowler, again

“A Fallacy of Software: If it works, and we don’t change anything, it will keep working.” ~Jessica Kerr

“Make sure you have good tests before refactoring. Run the tests as often as possible. That way you will know quickly if your changes have broken anything.” ~For the hat-trick: Martin Fowler

Happy refactoring, and thanks for making the world a better place with more flexible, more readable code!

--

--

The IHME Tech Team’s Blog. You’ll see how we resolve technical challenges and get some insight into how the IHME Tech team works. Articles are all directly from the people who make IHME such an amazing place to work. Enjoy!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store