Agile Atlanta User Group   TestFirstChallenge UserPreferences
 
Help Search Diffs Info Edit Print View

On Feb 12 2002, we had our meeting based on WilliamWake's TestFirstChallenge.

For this meeting, we tried something a little different. We took on the Test-First Challenge. (http://www.xp123.com/xplor/xp0201/index.shtml) In the TFC, the author (William Wake) wrote a series of tests using JUnit, and the objective was to make the tests pass, one test at a time, refactoring on the way. At various points in the process, we stopped to discuss how we were doing various things, and offer commentary.

There were 3 pairs (one of which was overloaded). One poor pair was using notepad as their editor. We all got through Part1 of the challenge and we were in varying positions developing the code for Part 2 when we had to stop. It was lots of fun, and the plan is to pick up where we left off at the next meeting. Don't worry if you weren't there this time, it won't be hard to catch up. If you've got a laptop (with Java), please bring it. If you like, go ahead and take the first part at home.

Here are my observations/comments from my pairing/TF experience:

1) Refactoring pays. We did not look ahead. On about the third test, we made a "bad" guess", and put the special handling in the storage code rather than in the retrieval code. Well, once we refactored, it was only about one or two lines in the storage code. When we got to a later test and discovered we had guess badly, moving the code to the retrieval was trivial.

2) During the first phase we refactored the code very well, and most methods were 3-4 lines in size. During the second phase, we got kind of side tracked and we have large method we need to refactor (about 25 lines).

3) Test First is really fun. I don't know how else to say. You get into a rhythim that is really unique.

4) Fast tests are important. I'm used to spending 5-10 seconds (minimum, up to 300 or so) to run my unit tests. I know some other members have said thats fast, but many of my tests seem to take about 1 sec/test. During the TFC, it was always measured in fractions of seconds to get all the tests to run. Because the tests were fast, I ran them more frequently, which kept my new code and my refactoring code small, which is good. I didn't use the debugger at all. When we got into the tokenizer and parser, normally I would have fallen back to the debugger. I didn't this time (though part of that is also having a good partner).

5) Pairing was fun.

6) Complete Tests are important. When we got to the complex part of phase 2, we decided to write some intermediate tests to test new classes we thought we needed. We wrote a tokenizer and got it to work, but we found a bug in it when we tried to use it, because our tests didn't cover "boundry conditions".

7) TF is fast. We spent about 2 actually writing code. I'm convinced that in day we would have a useful SpreadSheet engine, and in a about a week a powerful SpreadSheet engine. I NEVER would have thought that we could produce such a thing that quickly.

For those others that were there, please post your observations from the meeting, any comments you have on mine. I'm going to go place this on the group Wiki, too. Feel free to archive your thoughts there, too.


PythonPowered