Holmes on Home

Tearing Down the House

With the recent move into our new house I have started getting the "home improvement" bug. Each day I add more things to my list that I want to accomplish which will make my house that more awesome. Often times these items on my list aren't because I have to, or even want to, it's just because I can!

For my entire life I have lived in someone else's "home". Whether it was when I was young and living with my parents, living in the dorms in college, or renting various homes and apartments after college, I've always had to ask for permission to make changes to the places I was living. Not so anymore. I own this house and if I want to smash down a wall, I can!

Having this "home renovation" bug has somehow led to HGTV shows stealing a lot of DVR space. The biggest favorite right now is Holmes on Homes. Quick synopsis - genius contractor goes around fixing other "terrible" contractor's work. His big motto is: "If you're going to it, do it right."

Software Rewrites

As fate would have it, I am also in the middle of a "rewrite" of an existing application. It's a web application that's over 4 years old and in need of some updating. A 4 year old web application is akin to a 40 year old house. It still stands and runs but there are so many things that could be done better. 

I've been reading a lot of things on "rewrites" and the common consensus is: NEVER DO IT.

Common reasons are:

  • The idea that new code is better than old is patently absurd. (Joel on Software)
  • Don't do it because it will take longer than you think - much longer. (Daniel Chudnov)
  • This is a longer, harder, more failure-prone path than you expect. (Chad Fowler)

I think these "no rewrite" ideas are crap.

Every software program needs a little rewriting every now and then. The goal of a programmer is to consistently make the software suck less with every release. I think all too often developers forget that going back into the existing code base and tidying up by rewriting code consitutes as "sucking less".

HGTV and Software?

So what exactly does home improvement have to do with software rewriting? I believe there is a lot to be learned from home improvement contractors when it comes to rewriting software. Here's why:

  1. Unless the house is condemned and deemed unlivable, a good contractor will never start over on the house.

    If a home owner brings in a contractor to do some work, you'll rarely find that contractor walk in and state that the house should be ripped down and started over. Sure, it could mean more money and would also mean that the contractor wouldn't have to deal with existing architecture... but the core of the structure already exists and there already permits for the work and the existing architecture is up to city and state code.

    This rule is number one because it is the most important. When faced with rewriting an application, do NOT automatically think that you can simply scrap the whole project and start over unless the code is "unlivable" and by unlivable I mean that it is currently not used in any production environment and fails to run. The code may have flaws and the design may be messy, but somewhere in that code are existing business rules which have gone through QA cycles and have been approved. To think that you will satisfy every one of those business rules again when you are done rewriting is silly. Prioritize your rewrite work, start with the major problem areas first and work your way down.

  2. A good contractor NEVER starts without blueprints and permits.

    To make changes to an existing house for upgrades and structure changes, a contractor has to get approval from the city government by means of a permit. To get a permit, you have to have a plan. Without the blueprints, how are sub-contractors and specialists going to get everything right? Without the permits you won't have the backing of insurance companies and government.

    Blue PrintsWhile rewriting code may be smart from an engineering standpoint, if you don't have the backing of the business you're asking for a world of hurt. You are employed for one reason: to make the company profitable. Rewriting code is extremely hard to justify to the business as being profitable for the company. Many sales and management people think, "if the wheel turns, why fix it?". You, as the developer, need to present the business with the blueprints and prove how and why it will make the company money, otherwise your rewrite is destined to fail.

  3. A good contractor brings in specialists to do the work.

    Contractors, most of the time, are more directors then they are the primary worker. They know how to properly manage sub-contractors who are specialists in their field, be it plumbers, electricians, or roofers. You would never see a contractor bring in an electrician to lay a new concrete patio.

    So you've got your priorities and plans together and the business is 100% behind you. Make sure you find the appropriate developers for the job. I don't believe in the "can do everything" developer. I would rather have a developer that is 85% awesome in one area, than a developer who is 35% awesome in many areas. You'll need to get your specialists on the code base with which they are most knowledgeable and most comfortable. The trick with having many specialists working in their fields is that they are going to rely on you to orchastrate all of their movements. Keep them organized and working as a single unit and you'll have your application re-written in no time at all.

  4. "If you're going to do it, do it right."

    Since you have decided to rewrite an application you clearly have some issues with how it is currently written. There are many reasons you may have issues with it: poor programming, non-performance, old architecture, etc. Under no circumstances should you let any of those issues sneak their way into your re-write, otherwise you've just spent time and money on something that will have to get rewritten soon after anyway. Do it right.

Rewriting can be daunting and very intimidating, but as long as you have a good plan, have the business behind you, and remain completely transparent you'll be set to have an amazing new application and the accolades of a job well done.