Audience Participation Testing

Ovid on 2004-08-13T23:09:46

At Portland Perl Mongers, we've had chromatic give talks about tests and Schwern rant about tests. Since many people still aren't testing, I had an interesting idea, but now I have to put my money where my mouth is.

In October, I'll bring my laptop and have no presentation whatsover. Instead, I'll take an idea for a module from the assembled mongers (I'll have a backup idea or two if the ideas are not practical) and I'll sit down and create the module, in front of them, using test-driven development. Further, it's going to be mathematically challenged pair programming as I'll invite everyone to kibitz, er, pair, and we'll build a module together with me explaining things as we go. What an /aw(?:some|ful)/ idea. This could turn into a fiasco.


Doing tests...

zatoichi on 2004-08-14T00:09:10

I love the idea about tests. However, I am not doing anything (that I believe) warrants that level of testing. That may change, I am currently reading "Perl Medic" by Peter Scott and I am really impressed so far.

Re:Doing tests...

Ovid on 2004-08-14T01:00:14

Interestingly, I was at Powell's Technical Bookstore the other day and I noticed that not only was "Perl Medic" the best selling Perl book, it was also one of their top selling books over all. Amusingly, their top Java book's subject was about how to avoid bloat in Java programming.

Re:Doing tests...

chromatic on 2004-08-14T16:38:07

Hm, was that second book also Perl Medic?

Re:Doing tests...

Adrian on 2004-08-14T10:25:04

love the idea about tests. However, I am not doing anything (that I believe) warrants that level of testing.

Then you need to go see Ovid's talk! The point about TDD is the fact that it helps you drive your code's design, getting a good test suite out of it is just a pleasant side effect :-)

Go for it. Live TDD demos are good!

Adrian on 2004-08-14T10:12:37

I've done it a couple of times when running tutorials for some companies.

Random advice:
  • Practice with a couple of friends first. Doing TDD in front of a group feels odd at first. It's quite different from pairing since they can't take over and drive.
  • The best setup I've found is to have a laptop in front of you facing the audience on the same level so you can make eye contact easily, and back project the code you're running.
  • Switching between overlapping windows quickly can confuse the audience. I always have three windows open and arranged so they can all be seen at the same time. One for the code. One for the tests. One for the result of ./Build test (which I setup to run automatically when I save either code file.)

Have fun!

Re:Go for it. Live TDD demos are good!

jplindstrom on 2004-08-14T12:12:05

Great advice!

Have you found any "assignments" be more successful and pedagogic than others? Anything to avoid?

Re:Go for it. Live TDD demos are good!

Adrian on 2004-08-14T15:01:55

Have you found any "assignments" be more successful and pedagogic than others? Anything to avoid?

I guess pick something that you can get up and running quickly, but can expand easily if you have time. I found that it can be quite a shock how much slower TDD is when you have to explain as you go.

Some of the things I've used:

  • The classic "money in multiple currencies" example from the Beck book. You can go from simple math with a single currency, to dealing with transactions over time with multiple exchange rates (not that I ever got that far.)
  • Scoring of games. I use snooker as my example being in the UK. Use whatever you're more familiar with. Start with correct scoring of an existing game. Move to detecting illegal games. Generalise to cope with similar games... and so on...

Re:Go for it. Live TDD demos are good!

brian_d_foy on 2004-08-15T00:56:52

Good advice :)

I did this sort of thing for Perl University (O'Reilly's travelling road show that they only did for a year). It was a big hit.

I had a constraint though: I had in mind a handful of problems, and they audience could pick one of them. That way I didn't get stuck on something I couldn't work my way out of.

Go TDD Go!

petdance on 2004-08-14T21:07:57

At the next Chicago PM, we're going to be Phalanxing a module, live and on stage, basically adding tests that don't yet exist. It'll be interesting, too.

I've done the "build a module from scratch" to demonstrate the parts that go into it. Module::Starter basically started from there.