Refactor Constantly

Change is a good thing. Embrace it!

Brad Teller
Mar 9, 2014 · 3 min read


  • Make your code more unit testable.
  • Adhere to design patterns.
  • Make it more readable.
  • Make it more maintainable.
  • And so on …

Does this violate the Open Closed Principle? Yes, I guess it does. The whole idea behind refactoring though is that you will eventually get your code to the point where additional refactorings are no longer needed. If you work in an environment like I do though, you are constantly adding new code, so there is constantly code to improve.

Have A Plan

Don’t Start Right Away

I like to keep notes about what code to refactor in Evernote. Anything like that I’ll add a “.refactor” tag too, as well as a “.todo” tag. The “.todo” tag lets me know that I want to revisit that note for one reason or another. With that note saved off I’m not worried about forgetting any of my fantastic ideas, and I can also sleep on it for a night, a week, or for however long it takes.

Baby Steps

This is another trap I fall into though… I start changing everything at once. It feels great too! I’ll sit there and marvel at how productive I’ve been. It isn’t worth it though, because you’ll screw something up. Here is my advice.

  • Take your time.
  • Talk things over with your team, if you have one.
  • Figure out which changes are the most important or impactful.
  • Above all, make sure everybody on your team knows what is coming, and why.


Happy refactoring!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

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