Teaching test-driven development and continuous integration with "Evil Fizz Buzz"

Fizz Buzz is the word-game in which players in a circle count from 1 up, substituting multiples of three with "fizz" and multiples of five with "buzz" ("1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, …").

Evil Fizz Buzz is Jason Gorman's exercise that uses Fizz Buzz to teach continuous integration and test-driven development, played with five or more software developers.

The players divide into five groups, each tasked with a different component of writing a program to output correct Fizz Buzz sequences:

1. Generate a list of integers from 1-100

2. Numbers that are divisible by 3, replace with "Fizz"

3. Numbers that are divisible by 5, replace with "Buzz"

4. Numbers that are divisibele by 3 & 5, replace with "FizzBuzz"

5. Output this list as a single comma-delimited string

Teams can whiteboard and discuss together, but teams can only contribute code related to their task, checking it into a source control repository. That's when it gets interesting:

Once you have a working (green) build on a skeleton solution (i.e., one that compiles and runs at least one dummy test), the build must not go red. This is an exercise on delivering as a team WITHOUT BREAKING THE BUILD. OK? If the build goes red again, the exercise is over.

The team has 1 hour to deliver a working solution they can demonstrate to the "customer"

(via Four Short Links)

(Image: Excirial, CC-BY-SA)