Here’s the scenario:
You’re working on some software. You need to add some new functionality to it, and in looking through existing stuff you see the methodology in place. You don’t think it’s the best way to do it (or maybe it’s objectively incorrect for some reason), so what do you do?
a) Spend a lot of time re-working the existing stuff into a “better” way of doing it, then quickly add in your new stuff now that the framework is in place.
b) Write in the new methodology and supporting classes etc, then add your new stuff in and comment the old stuff with
// @TODO: Update to new methodology.
c) Just write your new stuff in the old “incorrect” or less preferable way, sigh, and get on with the next task.
Answers on a virtual postcard please.
Personally I’ve done all three of these, with no particular favourite. That might be the answer in fact, that different situations and time pressures require you to take the easy option. I know that re-working existing code into a nice framework will provide a good footing for my new functionality, but it’s at the risk of changing or breaking existing functionality that shouldn’t have been affected.
This probably doesn’t just apply to software development, either. This year I’ve been renovating our kitchen. At one point we had the decision on whether to take the old water-damaged ceiling down or not. My options were:
a) Rip the old ceiling down, re-do all wiring in the kitchen (lights and power), put new plasterboard up, new fittings, have it plastered and paint it.
b) Put new plasterboard up over the top of the existing ceiling, have it plastered, paint it. Thus keeping the old lighting locations and meaning I couldn’t redo the electrics or put outside lights in.
c) Paint the old ceiling and get on with my life.
I went for a). Turns out that was the right thing to do, because now we have outside lights, new spotlights replace the old striplight, and we have loads more plug sockets (removing some dodgy wiring in the process), but I didn’t know that before I started.
Have I just answered my own question?