Plan to throw one away refers to prototyping. If you don't prototype, you'll write and re-write as much code, in debugging and ading features ... except you'll be doing it with released code.

The other side of the coin is second system syndrome. It's discussed in Joel Splosky's article Things You Should Never Do. The basic idea is that you decide an evolving program has become so crufty that it can't be repaired or improved, it has to be totally re-designed and re-written. Nine or ten years later, Netscape 6 becomes available. The problem is that you are starting over, generating a totally new product, just like your competitors do ... except you have to remain compatible with your features while they don't.

The correct solution, according to Joel, is to adopt the eXtreme Programming concept of refactoring, that is, extracting code and encapsulating it into a routine. refactoring is inlining in reverse, if you know C++.

That is, instead of throwing it away, baby and bathwater and all, improve things, one item at a time. Take repeated code and convert it into a routine. Take a bunch of related routines and turn them into a module, or an object. Once concepts are separated, it becomes simpler to benchmark things, and replace a module with a different implementation, a different algorithm.

Of course, you need testing to determine whether changes break existing requirements. But you'll only regret writing tests until the first time you go back to do maintenance on existing code, and find you can verify correctness in a fraction of the time. Anyway, that's a topic for a different Seeker of Perl Wisdom.

--
TTTATCGGTCGTTATATAGATGTTTGCA


In reply to Re: rebuilding working code by TomDLux
in thread rebuilding working code by jfroebe

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.