Bill Morefield My thoughts, discoveries, and occasional rambiings.

September 21, 2011

Code Never Dies

Filed under: Programming — Tags: , , — Bill Morefield @ 8:36 pm

I spent much of the afternoon working on a new VBScript script.  Why would anyone do such a thing?  Because more than seven years ago I’d written a VBScript that did everything I wanted except output the data in the correct format.

The original code was a simple connector module that took a feed out of one system and loaded the data into a database meant for another system.  It has been running for most of those seven years and hasn’t been updated since the source system changed about three years ago.  It works and honestly there is no need to rewrite the program in a newer language since it’s simple, works, and isn’t a high priority process.

So today I needed to take that same source and produce a text file with a small subset of the data.  I could have written and tested a new script in PowerShell or a program in C#, but in reality I just needed to change the output from a database to a CSV file.  It took about an hour to rewrite and another hour to test.  It would have taken at least twice as long to write from scratch.

The lessons are that so much old legacy cold stays around is that it works.  The original script has more than three years of successful runs behind it with real data.  Testing can give you confidence, but working in production is hard to beat.

It’s also nice not to reinvent the wheel.  This is a once a year process that has been done manually more often than not.  It took about four hours to manually handle last year so this year I spent two hours to automate it.  Next year it will run in a few minutes.  That’s a good savings in time and effort.

Powered by WordPress