Refactoring to Reduce Code Isn’t Your Only Concern

The goal of refactoring is not simply to reduce the lines of code, it is to make the code easier to work with in the future. This may sometimes mean writing more lines of code. You might take 5 lines of code and generate 15 lines by creating additional functions or objects…

Krishna Kumar

Whenever you start counting the number of lines of code added or removed, then you are measuring the wrong thing (1). I’ve seen some people reject great refactorings because they added more lines of code. Just remember that refactoring isn’t about reducing the size of your code, it’s about increasing the quality of the code. Size doesn’t matter.

(1) Unless you’re removing a ton of code by using a standard library instead of custom code. e.g. removing 1,000 lines of custom authentication in favor of a authentication gem.

About Eric Davis

I founded Little Stream Software where I help new entrepreneurs build a successful software business. I also created an ebook, Redmine Tips, where I show you how to become more productive using Redmine. I am also the author of Refactoring Redmine, where I go about refactoring Rails using Redmine as an example. Follow me on Twitter and Google Plus.

, ,

No comments yet.

Leave a Reply