Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) 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.

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 --

In reply to So I'm in a bit of a quandary by vek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (11)
    As of 2015-07-02 08:22 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (31 votes), past polls