Fun at the Dojo Rio

I went to Rio after the São Paulo Perl Workshop. Doesn't it look like fun? Don't you want to come to YAPC::Brazil to have as much fun?

Last night Breno took me to Dojo Rio. I had never been to a Dojo before, and it was a very cool way to socialize and learn about other languages. I don't think this meeting was typical because I gave a short TDD presentation first where I started with a new Perl module then slowly added some features to it. I should have screencasted it, but I forgot to set that up.

Some of the people weren't strong in Perl, but most of them knew the ideas. After they watched me make several mistakes, we eventually got through adding tests and implementing a new method. Part of the Dojo idea is that you have to let the person working in front of the group puzzle out the problem on their own.

In the second half was even cooler though. The Dojo starts with two pair programmers and a four minute timer. They work on the agreed-on problem for four minutes, then one person steps out and another steps in. They implement as much as they can in the four minutes before they rotate again.

Our problem for the night was FizzBin (which is also a Learning Perl exercise). When it was my turn to be one on the pair, I said that we should test random multiples of three. We started with a line of code like this:

foreach my $i ( 1 .. 10 ) {
    is( fizzbin( $i * 3 * ( rand(100) + 1 ) ), 'bin', 'Works for multiple of three' );
    }

Now, for most people, it's obvious that it's broken, but in the Dojo format, the audience jsut watches and they aren't supposed to yell out the answer. After a couple of test runs, we regained our senses and remembered that rand returns a non-integer, so we need to int:

foreach my $i ( 1 .. 10 ) {
    is( fizzbin( $i * 3 * int ( rand(100) + 1 ) ), 'bin', 'Works for multiple of three' );
    }

Yeah, I'm as dumb as the next coder.

At the end of the night, the group went through what was good and what they could improve about the coding exercise (my contribution was to use table-driven testing).

I'd write more but I have to go have more fun in Rio. :)

2 Comments

Is this your version of cloud computing? :)

Leave a comment

About brian d foy

user-pic I'm the author of Mastering Perl, and the co-author of Learning Perl (6th Edition), Intermediate Perl, Programming Perl (4th Edition) and Effective Perl Programming (2nd Edition).