It’s OK to rewrite applications from scratch (sometimes)

You may have heard that rewriting an entire application is something you should never do. As usual, this is great advice 99% of the time. Recently I was tasked with writing the new version of our payroll product and we as a team decided to write the product from scratch for the following reasons:

  • We were upgrading from classic asp to asp.net, so all of that code couldn’t be shared anyway
  • There were serious performance problems with the existing system, so there likely wouldn’t be much use in keeping the database related code.

After completing the rewrite, I realized the main reason it was successful was because the core domain knowledge about how things should work was still there, shared between 3 separate employees. When I started, I didn’t know that much about how the product worked outside of what I knew from using it. I was given a sheet with the desired features, and some mock-ups of what the user interface would look like, and from there it was my job to figure the rest out.

I was able to ask the people who had written the prior versions (yes, more than one) whenever I didn’t know why something was supposed to be a certain way when it did not make sense to me, or when I found the behavior of something to be ambiguous. I found that it didn’t matter how I did something as long as the way I was doing it wasn’t wrong. While that may sound stupidly obvious, acknowledging this fact can free you to make very radical decisions that may not have seemed obvious before.

Once you are no longer constrained by your preconceived ideas about how something should be done, you are then free to solve the problems like performance problems without sacrificing the features of the application or the integrity of the code.

So, was the rewrite worth it? Absolutely. The most important part of the system saw increased complexity due to new features while simultaneously seeing a 100x increase in performance. The only reason this was possible was by completely rewriting the program from scratch.

I should note, however, that rewriting an entire application is still incredibly hard. It’s a lot of work and it takes a long time. It took me about 9 months to complete it and during that time I even rewrote the new code I had written about 15 times as well as I iterated and improved as I learned. A full rewrite definitely requires the right person or the right team to be successful.

Ultimately, I would say that it is OK (and perhaps advisable) to at least consider rewriting an application when there are significant complications to modifying the existing application, you still have enough of the core knowledge about the existing application at your company, and you have the time to pull off a rewrite. Even if you meet all the following criteria, a rewrite isn’t always right, but it is worth considering.

About these ads

4 thoughts on “It’s OK to rewrite applications from scratch (sometimes)

  1. I hate this saying. Security and code design issues are rife in many projects, and when I write my own I can usually do it in 10% of the code in a better way.

    I don’t think it should be as definite as it is.

    Maybe 60% of the time?

  2. That is why you should choose a good programming language initially. Then there is no need to rewrite it. I think VB6 is the best programming language because you don’t make mistake so bad to need rewrite.

    • @Weng. Your comment makes no sense at all. Not only on the basic position you’re asserting (nothing in the post asserts the language was a problem or a solution), but also in your choice of language. VB6 is known to be deadended. MS has stated it is phasing out all support for the language after Windows 8. If you think no one’s going to have to port VB6 code after that, you have not thought about this issue very much at all.

  3. Pingback: Delete your code | On Software

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s