XP is just a number | |
PerlMonks |
Re: OT: Rewrite or Refactor?by bobf (Monsignor) |
on Aug 27, 2006 at 04:30 UTC ( [id://569858]=note: 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 Section
Meditations
|
|