Search the web
Sign In
New User? Sign Up
testdrivendevelopment · Test-driven Development
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Re: [XP] Re: Personal experiment: test-first-design   Message List  
Reply | Forward Message #1732 of 32012 |
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>





Sat Jul 20, 2002 4:29 am

attkeithray
Offline Offline
Send Email Send Email

Forward
Message #1732 of 32012 |
Expand Messages Author Sort by Date

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...
C. Keith Ray
attkeithray
Offline Send Email
Jul 20, 2002
4:29 am

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... ...
r.blum@...
groby_b
Offline Send Email
Jul 20, 2002
7:25 pm

... 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...
C. Keith Ray
attkeithray
Offline Send Email
Jul 20, 2002
8:26 pm

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?!...
J. B. Rainsberger
nails762
Offline Send Email
Jul 21, 2002
5:14 pm

... 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...
Laurent Bossavit
morendilfoo
Offline Send Email
Jul 21, 2002
5:21 pm

Touche. *********** REPLY SEPARATOR *********** ... http://docs.yahoo.com/info/terms/ J. B. Rainsberger, President, Diaspar Software Services Let's write...
J. B. Rainsberger
nails762
Offline Send Email
Jul 22, 2002
9:34 pm

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...
Kent Beck
kentlbeck
Offline Send Email
Jul 22, 2002
11:32 pm

... Are congratulations in order? What's left for the book? --PSRC...
psrchisholm
Offline Send Email
Aug 4, 2002
8:26 pm

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...
Kent Beck
kentlbeck
Offline Send Email
Aug 4, 2002
8:49 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help