A Test-Driven FizzBuzz Test
Joey deVilla is testing interview candidates with FizzBuzz:
I asked each candidate to do the exercise in the programming language of their choice, with pen and paper rather than on a computer. By requiring them to use pen and paper rather than letting them use a computer, I prevented them from simply Googling a solution. It would also force them to actually think about the solution rather than simply go through the “type in some code / run it and see what happens / type in some more code” cycle.
Commenters are expressing violent disagreement, violent agreement, and violent alternative implementations in everything from Perl to Racket.
One thing missing from the discussion was a worked example. To fill the gap, here’s a video of me driving FizzBuzz with tests:
- Tests “force you to think about the solution”, without googling, and without pen & paper.
- You see the algorithm built in small steps. When you take big steps, it’s easy to get lost. When you take small steps, errors are small and easy to find. Being able to take small steps is a useful skill. Demonstrating that skill with pen & paper in about 3 minutes seems… tricky.
- These are my tools at work. This is much closer to how I solve other problems. A formal, repeatable feedback loop helps thinking through the problem.