Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

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

Hi All

I need the wealth of your wisdom and experience in software development, so this is not related to Perl per se. Hence 'OT' in the subject. The software that I've been working on for the past 2.5 years has become so hard to optimise and modified. We had a meeting last week and we decided to re-architect it.

The basic problem is that the software is written as one monolithic mod_perl application, which appears to be three different products to the client. To be able to go forward, we need to do deep surgery on it and split it to different independent sub-systems and layers. We also need to majorly change the database structure. Although we might be able to reuse the existing modules, I am sure that the new architecture will be completely different from now.

This brings me to question, "HOW are we gonna do it?" There are two options: First is to Rewrite, and second is to Refactor. I'll list the good and the bad of each approach from my point of view. Then I'd like to hear what y'all have experienced when facing problems like this.


My definition of Rewrite is to create the new architecture and then copy the relevant modules from the old code base with probably some modifications to fit the module with the new architecture. So this is not a complete rewrite, but this is not a refactoring either.

The good

  • We can start from a clean state, which doesn't carry baggages from the old architecture.

The bad

  • We may miss some functionalities from the old system while porting the modules.
  • The old code base could have been changed while we're working on the new code, which makes a porting nightmare.
  • The new code base isn't tested to handle the load of the production code, which mean we'll have performance problem on the first few months after launching the new code.


My definition of Refactor is to change the code one thing at a time, whithout affecting functionality.

The good

  • Less likely to miss functionalities from the old code base.
  • The original code has already been tested on production.

The bad

  • We might not end up with the new ideal architecture, because refactoring works on the code level, not on architectural level.

I haven't made up my mind on either approach. And due to my limited experience, I can't get a more exhaustive list of the good and the bad of them. Can you help?

Thank you

UPDATE: Thanks for everyone who've provided their insights. More insights are welcome. Up to this minute the best insight is from GrandFather, which suggested to refactor by creating interfaces and test suites.

UPDATE: Strangler Application pointed by adrianh seems to be the technique that incorporate interfaces mentioned by GrandFather. Great suggestions guys!!! Keep it coming.


In reply to OT: Rewrite or Refactor? by badaiaqrandista

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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (8)
    As of 2020-10-19 16:35 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (205 votes). Check out past polls.