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

Re: [XP] Re: Personal experiment: test-first-design

Expand Messages
  • C. Keith Ray
    I m sure the TDD book is getting fat now, but I d like to read a dialog like this in there somewhere... I m massively editing what Robert (r.blum@gmx.net) and
    Message 1 of 9 , Jul 19, 2002
      I'm sure the TDD book is getting fat now, but I'd like to read a dialog like
      this in there somewhere...

      I'm massively editing what Robert (r.blum@...) and someone else, someone
      named Kent(?) wrote... Since I'm changing the text, I'll use different
      names.

      Calvin: "I don't do test driven programming. I write some code, and test it
      manually, walking through it in the debugger, checking that it works."

      Hobbes: "How do you know that it works? Could you express that as a test
      before you run your code?"

      Calvin: "I can't think about the test until I've thought about the code"

      Hobbes: "Changing the habit of writing code before the test can be a bother.
      Try this: Write the code on paper. Then write a test."

      Calvin: "Paper?!"

      Hobbes: "What if you just outlined the code on a whiteboard and didn't write
      any real code? Could you still write a test first?"

      Calvin: "I'd feel silly doing that alone."

      Hobbes: "What if you explained it to your pair partner? Could you still
      write a test first, or maybe have your pair partner write the test?

      Calvin: "That could work."

      Hobbes: "I notice you're refactoring without tests. What's that like?"

      Calvin: "After I refactor, I have to test it again manually, in case I make
      a mistake doing the refactoring."

      Hobbes: "Wouldn't it be easier to run some quick tests before and after you
      you refactor?"

      Calvin: "Well duh! If I had the tests."

      Hobbes: "If you do test-driven development, your tests drive the design of
      your code, and as a side-benefit, you get a nice small set of regression
      tests that make refactoring safe."

      Calvin: "Perhaps if I start by thinking about the interfaces that my class
      or module would need to support, I would be able to write the unit test
      first? Does this sound like the kind of thing I should be trying more of?"

      Hobbes: "I think so. If I were given just the task of writing a class or
      module, my first test would describe a very simple case of what I wanted
      from that code. The interface of this not-yet-written code is evolving, of
      course, during my test-driven development process. Since I'm calling the
      functions that I need at each moment, without a care how (or if) they are
      implemented, it tends to create a pretty useable interface."

      Calvin: "So you find out quickly if your interface functions are no good
      when you're forced to use them as client, in the tests, before investing a
      lot of work at writing them!"

      Hobbes: "Now you're getting it."

      Calvin: "Tell me, when you think of a feature, is your next thought about
      testing or implementation?"

      Hobbes: "I just think about using that feature. Which leads me to an example
      of how I would use it. Now I just write down the results I expect from that,
      and voila, there's the test. I'm not even actively thinking 'I have to write
      a test now. How can I test it?'. My main focus is how I can use it."


      ----

      C. Keith Ray
      <http://homepage.mac.com/keithray/resume2.html>
      <http://homepage.mac.com/keithray/xpminifaq.html>
    • r.blum@gmx.net
      Hi Keith! The someone named Kent is (IIRC) Kent Beck, the guy who wrote the book on TDD. :) You could probably safely attribute most of the dialogue to him...
      Message 2 of 9 , Jul 20, 2002
        Hi Keith!

        The someone named Kent is (IIRC) Kent Beck, the guy who wrote the book on
        TDD. :) You could probably safely attribute most of the dialogue
        to him...

        Anyway, thanks for sharing this with us! I like it very much!

        (Plus, I always wanted to put words in Hobbes mouth :)

        - Robert

        --
        GMX - Die Kommunikationsplattform im Internet.
        http://www.gmx.net
      • C. Keith Ray
        ... Actually not. I edited a message written by you, Robert, in which you were responding to Roger Lipscombe, but you incorrectly called him Kent. Maybe you
        Message 3 of 9 , Jul 20, 2002
          on 2002.07.20 12:25 PM, r.blum@... at r.blum@... wrote:

          > Hi Keith!
          >
          > The someone named Kent is (IIRC) Kent Beck, the guy who wrote the book on
          > TDD. :) You could probably safely attribute most of the dialogue
          > to him...

          Actually not. I edited a message written by you, Robert, in which you were
          responding to Roger Lipscombe, but you incorrectly called him Kent.

          Maybe you need more coffee. :-)



          on 2002.07.19 1:56 PM, r.blum@... at r.blum@... wrote:
          >
          > Hi Roger!
          >
          > (Sorry for addressing you as Kent in the last mail - didn't yet have my
          > coffee dose :)



          ----

          C. Keith Ray
          <http://homepage.mac.com/keithray/resume2.html>
          <http://homepage.mac.com/keithray/xpminifaq.html>
        • J. B. Rainsberger
          This is very interesting, and well-written, but I doubt Calvin would ever be that rational. Hobbes: Have you written tests for that code yet? Calvin: Tests?!
          Message 4 of 9 , Jul 21, 2002
            This is very interesting, and well-written, but I doubt Calvin would
            ever be that rational.

            Hobbes: Have you written tests for that code yet?

            Calvin: Tests?! TESTS?! I don't need tests! What do I need tests for?
            Don't you think I can write something this simple without using tests
            as a crutch?! I know it's right!

            Hobbes (rolling his eyes): Of course you do.

            Calvin: Right. Now help me fix these last four bugs.

            *********** REPLY SEPARATOR ***********

            On 2002-07-19 at 21:29 C. Keith Ray wrote:

            >I'm sure the TDD book is getting fat now, but I'd like to read a
            dialog
            >like
            >this in there somewhere...
            >
            >I'm massively editing what Robert (r.blum@...) and someone else,
            >someone
            >named Kent(?) wrote... Since I'm changing the text, I'll use different
            >names.
            >
            >Calvin: "I don't do test driven programming. I write some code, and
            test it
            >manually, walking through it in the debugger, checking that it works."
            >
            >Hobbes: "How do you know that it works? Could you express that as a
            test
            >before you run your code?"

            <snip />

            J. B. Rainsberger,
            President, Diaspar Software Services
            Let's write software that people understand.
            http://www.diasparsoftware.com/
            telephone: +1 416 791-8603
            All correspondence (c) 2002 Diaspar Software Services.
            If you want to use it, just ask; don't steal.
          • Laurent Bossavit
            ... Hobbes: I thought I was doing that. -[Morendil]- In XP, we don t divide and conquer. We conquer and divide. First we make something that works, then bust
            Message 5 of 9 , Jul 21, 2002
              > Calvin: Right. Now help me fix these last four bugs.

              Hobbes: I thought I was doing that.

              -[Morendil]-
              In XP, we don't divide and conquer. We conquer and divide. First we
              make something that works, then bust it up and solve the little
              parts.
              Kent Beck
            • J. B. Rainsberger
              Touche. *********** REPLY SEPARATOR *********** ... http://docs.yahoo.com/info/terms/ J. B. Rainsberger, President, Diaspar Software Services Let s write
              Message 6 of 9 , Jul 22, 2002
                Touche.

                *********** REPLY SEPARATOR ***********

                On 2002-07-21 at 19:16 Laurent Bossavit wrote:

                >> Calvin: Right. Now help me fix these last four bugs.
                >
                >Hobbes: I thought I was doing that.
                >
                >-[Morendil]-
                >In XP, we don't divide and conquer. We conquer and divide. First we
                >make something that works, then bust it up and solve the little
                >parts.
                >Kent Beck
                >
                >
                >
                >------------------------ Yahoo! Groups Sponsor
                ---------------------~-->
                >Free $5 Love Reading
                >Risk Free!
                >http://us.click.yahoo.com/wlyPtD/PfREAA/Ey.GAA/NhFolB/TM
                >---------------------------------------------------------------------~-
                >
                >
                >To unsubscribe from this group, send an email to:
                >testdrivendevelopment-unsubscribe@yahoogroups.com
                >
                >
                >
                >Your use of Yahoo! Groups is subject to
                http://docs.yahoo.com/info/terms/


                J. B. Rainsberger,
                President, Diaspar Software Services
                Let's write software that people understand.
                http://www.diasparsoftware.com/
                telephone: +1 416 791-8603
                All correspondence (c) 2002 Diaspar Software Services.
                If you want to use it, just ask; don't steal.
              • Kent Beck
                I m text-frozen, but this dialog deserves to be published somewhere. Add some examples and Dr. Dobbs or one of the Java publications would publish it. Kent
                Message 7 of 9 , Jul 22, 2002
                  I'm text-frozen, but this dialog deserves to be published somewhere. Add
                  some examples and Dr. Dobbs or one of the Java publications would publish
                  it.

                  Kent

                  > -----Original Message-----
                  > From:
                  > sentto-5031255-1732-1027139379-kentbeck=csi.com@...
                  > [mailto:sentto-5031255-1732-1027139379-kentbeck=csi.com@....y
                  > ahoo.com]On Behalf Of C. Keith Ray
                  > Sent: Friday, July 19, 2002 9:30 PM
                  > To: extremeprogramming@yahoogroups.com;
                  > testdrivendevelopment@yahoogroups.com
                  > Subject: [TDD] Re: [XP] Re: Personal experiment: test-first-design
                  >
                  >
                  >
                  > I'm sure the TDD book is getting fat now, but I'd like to read a
                  > dialog like
                  > this in there somewhere...
                  >
                  > I'm massively editing what Robert (r.blum@...) and someone
                  > else, someone
                  > named Kent(?) wrote... Since I'm changing the text, I'll use different
                  > names.
                  >
                  > Calvin: "I don't do test driven programming. I write some code,
                  > and test it
                  > manually, walking through it in the debugger, checking that it works."
                  >
                  > Hobbes: "How do you know that it works? Could you express that as a test
                  > before you run your code?"
                  >
                  > Calvin: "I can't think about the test until I've thought about the code"
                  >
                  > Hobbes: "Changing the habit of writing code before the test can
                  > be a bother.
                  > Try this: Write the code on paper. Then write a test."
                  >
                  > Calvin: "Paper?!"
                  >
                  > Hobbes: "What if you just outlined the code on a whiteboard and
                  > didn't write
                  > any real code? Could you still write a test first?"
                  >
                  > Calvin: "I'd feel silly doing that alone."
                  >
                  > Hobbes: "What if you explained it to your pair partner? Could you still
                  > write a test first, or maybe have your pair partner write the test?
                  >
                  > Calvin: "That could work."
                  >
                  > Hobbes: "I notice you're refactoring without tests. What's that like?"
                  >
                  > Calvin: "After I refactor, I have to test it again manually, in
                  > case I make
                  > a mistake doing the refactoring."
                  >
                  > Hobbes: "Wouldn't it be easier to run some quick tests before and
                  > after you
                  > you refactor?"
                  >
                  > Calvin: "Well duh! If I had the tests."
                  >
                  > Hobbes: "If you do test-driven development, your tests drive the design of
                  > your code, and as a side-benefit, you get a nice small set of regression
                  > tests that make refactoring safe."
                  >
                  > Calvin: "Perhaps if I start by thinking about the interfaces that my class
                  > or module would need to support, I would be able to write the unit test
                  > first? Does this sound like the kind of thing I should be trying
                  > more of?"
                  >
                  > Hobbes: "I think so. If I were given just the task of writing a class or
                  > module, my first test would describe a very simple case of what I wanted
                  > from that code. The interface of this not-yet-written code is evolving, of
                  > course, during my test-driven development process. Since I'm calling the
                  > functions that I need at each moment, without a care how (or if) they are
                  > implemented, it tends to create a pretty useable interface."
                  >
                  > Calvin: "So you find out quickly if your interface functions are no good
                  > when you're forced to use them as client, in the tests, before investing a
                  > lot of work at writing them!"
                  >
                  > Hobbes: "Now you're getting it."
                  >
                  > Calvin: "Tell me, when you think of a feature, is your next thought about
                  > testing or implementation?"
                  >
                  > Hobbes: "I just think about using that feature. Which leads me to
                  > an example
                  > of how I would use it. Now I just write down the results I expect
                  > from that,
                  > and voila, there's the test. I'm not even actively thinking 'I
                  > have to write
                  > a test now. How can I test it?'. My main focus is how I can use it."
                  >
                  >
                  > ----
                  >
                  > C. Keith Ray
                  > <http://homepage.mac.com/keithray/resume2.html>
                  > <http://homepage.mac.com/keithray/xpminifaq.html>
                  >
                  >
                  >
                  >
                  > To unsubscribe from this group, send an email to:
                  > testdrivendevelopment-unsubscribe@yahoogroups.com
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                  >
                  >
                • psrchisholm
                  ... Are congratulations in order? What s left for the book? --PSRC
                  Message 8 of 9 , Aug 4, 2002
                    --- In testdrivendevelopment@y..., "Kent Beck" <kentbeck@c...> wrote:
                    > I'm text-frozen ...

                    Are congratulations in order?

                    What's left for the book? --PSRC
                  • Kent Beck
                    1. I get the copy edits back 2. I apply the copy edits 3. I apply the book template 4. I typeset (page and line breaks, final position of figures, etc) 5. I
                    Message 9 of 9 , Aug 4, 2002
                      1. I get the copy edits back
                      2. I apply the copy edits
                      3. I apply the book template
                      4. I typeset (page and line breaks, final position of figures, etc)
                      5. I wait impatiently for real books

                      The real books may be ready for OOPSLA. I was a bit tardy (that bastard
                      Fowler is laughing at me because he was done two months ago).

                      Kent

                      > -----Original Message-----
                      > From:
                      > sentto-5031255-1841-1028492779-kentbeck=csi.com@...
                      > [mailto:sentto-5031255-1841-1028492779-kentbeck=csi.com@....y
                      > ahoo.com]On Behalf Of psrchisholm
                      > Sent: Sunday, August 04, 2002 1:26 PM
                      > To: testdrivendevelopment@yahoogroups.com
                      > Subject: [TDD] Book status?
                      >
                      >
                      >
                      > --- In testdrivendevelopment@y..., "Kent Beck" <kentbeck@c...> wrote:
                      > > I'm text-frozen ...
                      >
                      > Are congratulations in order?
                      >
                      > What's left for the book? --PSRC
                      >
                      >
                      > To unsubscribe from this group, send an email to:
                      > testdrivendevelopment-unsubscribe@yahoogroups.com
                      >
                      >
                      >
                      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                      >
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.