UPDATE: I’ve created a new subdomain for the FizzBuzz Overthink project ( http://fbo.masukomi.org ), updated the links below to reference it instead and modified the Readme in the project (and the default page of the site) to reflect the new goals of the project
I was talking with someone the other day who mentioned, in passing, how they wished they had some good examples of how to do unit tests for his co-workers. There are, of course, plenty of examples of how to do unit tests but I haven’t seen many online that show them in the context of a complete but simple application. This conversation made me remember my FizzBuzz Overthink (FBO) that I’d written in Java, and it occoured to me that it would make a great teaching application. Translating an existing FBO into a language you’re trying to learn is also a great way to get your head around it.
The FBO demonstrates how to break down an application into useful methods, how to write unit tests for those methods, and how to document them.
So, I’ve added a Perl version of the FBO, with docs and unit tests, although I used Natural Docs for the documentation instead of standard POD because ND is just light-years ahead of POD in my opinion. You can grab the new Java + Perl versions as a zip file or better yet check it out with darcs from http://fbo.masukomi.org/code/FizzBuzzOverthink/ so that you can improve upon it and / or add your own language to it to help make it a more useful teaching aid. Just use darcs send to send me a patch with your changes ( masukomi at masukomi dot org ). I think there are a lot of people who would benefit from a PHP version and I’d personally love to see Haskell and Erlang versions.