Why Refactor Code

I ran across a great example of why to refactor code. We have a system that users fill out some forms and processes are kicked off that route that data to a database and send out emails to different people based on certain user input. Before we rewrote the system in January of 06, to change who got a certain email took at least a 1 hour of coding time and an half an hour of QA. It was way out of wack. We totally rewrote the system in January but because of delays to other parts of the project the system didn’t go live until August of this year. So for 8 months we could have sat on our new code which worked. Instead every 2 months we revisited different code blocks and refactored. At most we spent less then an hour refactoring. This particular code block ended up getting refactored 4 times.

Today, I got a request to route emails to different people, based on new business rules. The end result took 2 minutes of code changes, and 3 minutes to QA. We use Watir to run automated test. Because we use source control I did some auditing. Looking back these are the number of lines of code that would have needed to change for today’s changes.

Refactor Date Lines of Code to Change
March 51
May 22
July 15
August 8

Refactoring code rocks!

Tim

A .NET, PHP, Marketing Guru authority, at least I hope I am. Reach me at tboland@gmail.com

2 thoughts on “Why Refactor Code

  1. Shared Hosting Resources…

    I couldn’t understand some parts of this article, but it sounds interesting…

  2. Web Hosting Providers Directory…

    Sorry, it just sounds like a crazy idea for me :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>