It gets even better after you've tried to apply your "general" solution a third time and found that it wasn't easy to re-apply. So you go back over the first two.

I've worked with several large OO frameworks. The most successful of these started out as successful applications, then gradually became frameworks as people copied the applications and re-used the code.

At some point (like after the first three applications), a re-factoring was done that expressed the common code into a simple framework. Capabilities were only added to the framework as it could be proven that they were needed, and only after considerable thought.

I've also seen cases where people tried to write general frameworks up front, and ended up writing lots and lots of code to support functionality that no one actually needed in practice. This is a waste of time and a source of bugs.

So I'd modify the recommendations given above to add step

6: iterate back over 4 and 5 with the next few new applications, refactoring as needed, and being willing to touch existing applications to bring them in line with the newest version of the module, library, or framework.

It's a lot better to have several working applications that use the same shared code. New users of the shared code can then look at the applications and see how to do it without being distracted by historical remnants.


In reply to Re: Why and how to re-use code to make better applications and you a better programmer. (discussion) by bikeNomad
in thread Why and how to re-use code to make better applications and you a better programmer. (discussion) by deprecated

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.