Chappell's First Law of Programming
(One from the archives. I wrote this ten years ago. I think it still stands.)
There have been many fine developments in the art of computer programming in the last few years. I especially appreciate "Test Driven Development" (I consider myself fully test-infected) and automated build processes using tools like ant or Maven. And there is still more to come, be it Aspects, grid computing, or lightweight web frameworks like Struts. This is all very good and I welcome it.
But there does not appear to be any great appreciation of, what is one of the fundamental "laws" of computer programming:
Working code trumps everything.
This is a basic truth, at the same level as "1 AND 1 = 1". Learn it, live it, there will be a test.
As a computer programmer (24 years under the belt, 14 with salary), I love to write code and I love to re-write old junky code, but I have learned that there is enough work to go around, without the gratuitous re-writing of old code. If it works, and usually it does, if we can be honest with ourselves, then we should leave it well enough alone.
I realise that this is close to the old adage about "don't fix what isn't broken", yet I feel that it's sufficiently different to deserve specifying individually. I'm not saying that we should ignore bad or faulty code, just because it mostly works. Any measurable error rate in code means that it doesn't work to my satisfaction. I'm talking mostly about legacy code, typically written in COBOL and running on a mainframe. We younger bucks (less than 28 hex thank you) tend to look at older systems and insist that they should be re-written in insert name of trendy programming language here. This is the time to remember that working code trumps everything. I don't care how buzzword compliant your latest language is, if I have working, proven code running, then I say leave it alone and figure out new and interesting ways to interface to it if you have to or just get on with writing some of the boatload of other systems that people are asking us for.