in reply to What to do when you realize you've written bad code

Personally, it's this very aspect of programming that keeps me doing it.

The fact that I can look back at code I've written a few years ago, or even weeks in the case of my Perl, and notice that I no longer do things inthe way I used to, means that I never get to the point were I could say "I've done it it all so I'm bored".

For the last few years I have kept an archive of code I have written (originally on optical disc, now CD's, DVD's soon.) and I wish I had started doing this 20+ years ago. I started out with the intention that I would be able to use it for code re-use and whilst there have been occasions when i have been able to simply crib something straight from the original version and use it, its a rarity. Most often I look back at the original, work out how I did it then and then re-code from scratch. The results are (mostly) a big improvement but because I can normally get back into the mindset I had when I wrote the original, I benefit from that as a starting point.

Back in the early 80's a company in the UK produced a program that caused a lot of hype. They called it "The Last One", with the meaning that it was the last program that human beings would ever need to write! One of my lecturers at that time suggested that those of us who were looking to making a career from programming might like to rethink as "it is patently obvious that before long all programs will be written by computer". I'm glad that a) I ignored this 'sage' advise and b) programming continues to be more craft than engineering. As a one-time mech.eng. (draughtsman) who had become bored with lack of challenge in that field.

Despite being of (now very apparent) mature years, my 'yearn to learn' is still strong, and is, in many ways, the saving grace of my sanity in a world filled with corporate dogma, rhetorical coding standards and the rule of lowest common denominator.


Long live the craftsman's Guild of Itinerent Software Labourers.
And long live its defacto creed of 'live to learn, whatever the source'. Down with nee-syndrome.
  • Comment on Re: What to do when you realize you've written bad code

Replies are listed 'Best First'.
Re^2: What to do when you realize you've written bad code
by Aristotle (Chancellor) on Oct 17, 2002 at 00:17 UTC
    Most often I look back at the original, work out how I did it then and then re-code from scratch. The results are (mostly) a big improvement

    An experience I share; I am continuously reminded of the old adage that you only really understand a problem after you've solved it. By definition this also means that you continuously improve your understanding of a problem with every iteration.

    I have found that even recoding once more yet usually yields another substantial improvement - third time's the charm, so to say.

    Makeshifts last the longest.