Saying no to refactoring code


Isn’t 80% of code quality just the choice of font and formatting?  :)

As a case in point, the code viewed in our git repository’s web interface somehow seems to much cleaner and more well organized than the same code in Eclipse. Psychologically that’s a good thing, and I’ve trained myself to look at the code online when the urge to refactor comes. If that doesn’t work, I look at the product backlog and listen to all the other stories calling my name. If by this point I am still not convinced, I run the unit tests and see the dots that roll across the console window, appreciating how much I prefer them to F’s (failure) and E’s (exception).

So when you are about to refactor something take a step back and… I don’t know, just say no.

On a more serious note, I think it’s a perfectly natural to want to tidy up the code, make things more ordered, more maintainable, etc., but if there is no immediate business issue behind it (especially if you are at the early stages), I feel refactoring anything is actually hindering your progress since it’s not bringing you any closer to your immediate goals. The odds are you are going to throw that code away anyways or discover that none of the customers want to use it.


3 responses to “Saying no to refactoring code

  1. A nice way of avoiding the fiddling-around, gold-plating variety of refactoring is to only refactor when the refactoring is driven by the addition of new feature (which is delivering new business value).

    If you want to refactor some class into a strategy pattern because you think you /might/ need a caching layer in the future, you say no. If you realize while implementing some new feature that it won’t work without some caching layer, then you refactor to make that caching layer happen.

    In my experience this helps a little in keeping code cleanup focused on the real goal – delivering business value.

  2. Pingback: What Build-Measure-Learn Is Not | turning things into products

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s