Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Without knowing anything about the code in the one application/three products, it will be hard to give you specific advice.

In past projects I've used a combination approach that attempts to balance the positives and negatives of refactoring and rewriting. In your case, I might suggest designing the architecture how you want it to be and then start to rewrite it, but take as many snippets as possible from the current code and refactor them as needed when you plug them into the new design (the latter might be aided by doing some minor refactoring of the existing code first - breaking out code into subroutines, adding blocks to tighten the scope of variables, etc). That would give you the new design that you need, but it would leverage some of the functionality and strengths of the existing code so you don't have to rewrite the whole thing from scratch (provided there are pieces that are good enough to salvage).

Regardless of the approach you take, the Perl Medic will likely help. In addition, a few recent threads may be of interest, including Strategies for maintenance of horrible code?, Consideration for others code, and Perl in the Enterprise (the latter mentions Devel::Refactor and the PPI refactoring editor).

Good luck.

Update: ++ to GrandFather for the comments about adding a test suite. I thought of it, then forgot to include it (that's what I get for posting while tired). Read his node - he said it better than I would have, anyway. :-)


In reply to Re: OT: Rewrite or Refactor? by bobf
in thread OT: Rewrite or Refactor? by badaiaqrandista

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!
  • 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, 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 avoiding work at the Monastery: (8)
    As of 2020-10-19 16:31 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favourite web site is:












      Results (205 votes). Check out past polls.

      Notices?