Loading ...
Sorry, an error occurred while loading the content.

Re: [XP] Refactoring between test cases

Expand Messages
  • Buddha Buck
    ... ... I wasn t at the event, and would
    Message 1 of 64 , Jul 3, 2001
      At 04:16 PM 07-03-2001 +0100, cwoodwar@... wrote:
      >Nick Fortescue posted a message on June 6th, 2001 about the XP2001
      >conference. In it he drew attention to Kent Beck and Alan Francis
      >demonstration on test first programming:

      <snip description of Kent Beck and Alan Francis test first programming a
      routine to convert numbers to Roman numerals>

      >I was surprised by the use of refactoring to improve code just developed to
      >satisfy the first test, in order to make it work for the second test, and
      >so on. I didn't realise the process was so fastidious. Why, for example,
      >with the knowledge (I assume) of the user story to convert integers into
      >roman numerals wasn't it sensible (or permitted?) to at least anticipate
      >from the start the requirement to code for values 1 to 5?

      I wasn't at the event, and would have been interesting in watching the process.

      My understanding is that the requirements to code for values 1 to 5 was in
      fact well-known and anticipated during the experiment, but they didn't let
      the requirements directly drive the code. They let the requirements drive
      the tests, and the tests drive the code. They follow the process of
      picking the smallest requirement not yet tested and write a test for
      it. Then they modify the program so the test passes, repeat.

      Yes, they knew that "Must convert all integers between 1 and 5 (inclusive)
      into Roman numerals" was a requirement, but it isn't a -small- requirement
      -- at least, compared to "Must convert 1 into Roman numerals". So they
      worked with the smaller requirement -- easier to test and code -- and
      worked their way towards meeting all the requirements.

      >Chris W
      >CSC Research Services
      >To Post a message, send it to: extremeprogramming@...
      >To Unsubscribe, send a blank message to:
      >Don't miss XP UNIVERSE, the first US conference on XP and Agile
      >Methods. see www.xpuniverse.com for details and registration.
      >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • kentbeck@csi.com
      ... different in ... task, the ... I probably change my test cases 1/4 of the time, sometimes before changing the code, sometimes instead of changing the code.
      Message 64 of 64 , Jul 9, 2001
        --- In extremeprogramming@y..., wecaputo@t... wrote:
        > Bear in mind that the task (and its originating story) tells you the
        > problem to solve. As you point out Matthew, the problem is
        different in
        > each of your O(*) algorithims, thus for a real story, and a real
        task, the
        > requirements would need to be different to result in your different
        > algorithims.

        I probably change my test cases 1/4 of the time, sometimes before
        changing the code, sometimes instead of changing the code. Learning
        when to suspect your test case instead of your code is part of making
        the shift to a journeyman testfirster.

      Your message has been successfully submitted and would be delivered to recipients shortly.