The point that you're ignoring is that to make the spec work, you need to decide internally where and when to switch strategies.

Yes - any version that implements the spec is correct. If your version doesn't implement the spec, it is incorrect. Any changes you need to make to your version to have it match the spec is internal to that version.

(BTW your refusing to call this switch an "optimization" is disingenuous at best.)

Why? You said that the "optimization" fixed bugs. To me, that's a bugfix. That it optimized the code is often a consequence of correct implementation.

Saying "this must work" and "that must be fast" says that you need 2 different strategies. It doesn't say where the boundary between them should be.

"This must work according to spec." is all I'm saying. The spec contains a speed requirement.

It doesn't say where the boundary between them should be. That boundary should be invisible to the user of your code. And therefore you have an internal code boundary that is not part of the external specification.

Does the code implement the spec? If yes, you may pass Go. If no, then go directly to Jail. If your version implements the spec and is faster than mine, that's wonderful. If it's faster, but it's wrong, then we're not comparing apples.

Furthermore without knowing the exact implementation, you can't specify how it works, because the appropriate boundary depends on the optimization chosen, which is highly implementation-dependent.

This sentence makes absolutely no sense to me. A specification tells you what it does. It most certainly doesn't say how it accomplishes that goal. And, yes, an optimization may certainly be platform-dependent, tools-dependent, etc. If your implementation wants to take those factors into account, it is welcome to do so. However, you're still implementing the spec, which, at the end of the day, is all that matters.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Re^11: Corner cases are not always "code smell" by dragonchild
in thread Neither system testing nor user acceptance testing is the repeat of unit testing (OT) by pg

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.