|laziness, impatience, and hubris|
So I'm in a bit of a quandaryby vek (Prior)
|on Jul 08, 2002 at 07:01 UTC||Need Help??|
Fellow monks I seek your wisdom.
I'm going to be adding some new functionality to an existing program. Unfortunately the code is ugly. No -w, no strict, global variables, highly inefficient and has red flags all over the place. The distinct lack of consistancy within the code is particulary worrying. Sometimes an array will be passed to a subroutine, sometimes a subroutine just goes to work on an array and you have no idea who/what/why/where the array was created. My first initial reaction was a rather loud "yuck" followed by a sigh. On impulse and from a future maintenance perspective I would like to re-write it .
There are a number of factors that a weighing heavily on my mind as I ponder the re-write:
1. The code is bad, but it's not broken. I keep hearing "if it ain't broke don't fix it" at the back of my mind. The program has been in production for a couple of years.
2. It's a large program and a re-write would take a decent amount of time.
3. My boss was the original author. I'll obviously have to tread lightly so as to not offend.
Trying to find a nice way to explain the re-write is proving harder than I imagined. I'm starting to wonder whether I should just leave alone and try to add the new functionality without changing the old code too much - but doing that will drive me nuts.
If you've ever come across similar circumstances how have you handled it?
Update: I think big thankies are in order to all who offered their advice. Nice one.
-- vek --