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.
And finally.
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.
Cheers.
--
vek
--
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.