I know this goes against standard XP guidance, but I find that writing that extra method for completeness sake is often in of itself a form of advanced test.

I think you are missing the point of You Aren't Gonna Need It. YAGNI is demand-loading applied to the writing of code. If you write code that you think you will need later, but you never use it later, you have wasted your time writing it. Worse than that, you might waste time trying to update the unneeded code to keep up with changes to the rest of the system. Unneeded code obviously should be left out, the only tricky part is knowing which code is not needed. All the code in a system was probably needed at one point in time, but if you go around writing stuff that you aren't even using yet, you create more cruft.

If you have a "supposedly general solution" that isn't, that is just a bug. In TDD, there ought to be a test written that shows the bug. And then the solution can be refactored to fix the bug. If it actually fixed the bug, all the new tests pass and all the old tests still pass. Without those tests, you have less confidence that your refactored solution is actually better than the old solution.


In reply to Re: Re: Unit Tests and Creative Tension by bunnyman
in thread Unit Tests and Creative Tension by dws

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.