Without knowing more about this, I'd say your biggest challenge here is what's known as design recovery. It doesn't sound like you have a lot of design docs or requirements beyond what is implicit in the system that "sort of works". You're going to have to recover the design from this implementation.

I would suggest not doing anything too drastic, not right away. I would attempt to build up your common library that does as much of the common functionality of the generated CGIs and migrate the generator to use these modules in the generated CGIs. Only when you have the code factored in such a way will you be able to see the true requirements.

You'll need a good test bed and the ability to migrate individual projects over to your new common libraries to ensure you don't break anything. Set up your development and test environment first. You need a dev environment where you build your new modules and a separate test environment where you field your changes in an environment as close to 'real world' as you can. If you can't afford building up this kind of infrastructure, perhaps you can't afford to rework this system.

If you can't afford to rework the system, then I'd propose that you spend all the time trying to understand and document what you've got so that you can maintain and debug it as it is currently structured.

Be very clear in your goals. I believe you when you say it's a mess, but have clear ideas about what you hope to improve. Is extending it too inflexible? Performance poor? Remember that your various goals might be cross-purposes to one another. You might increase flexibility and decrease performance.

You stated that debugging is too difficult, which suggests comprehensibility is a big problem, which is why I suggest the approach of improving it slowly with stepwise refinements. Don't be afraid of building up something that you'll eventually throw away in favor of a new architecture from the ground up. You might be building up these modules only for the purpose of understanding the system better so that you can intelligently rebuild it.

Updated: Grammar and spelling.


In reply to Re: (OT) Generated Code vs. Libraries by jordanh
in thread (OT) Generated Code vs. Libraries by Mutant

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, 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:
    & &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.