The FizzBuzz test is a simple way of showing that a developer has mastery of basic concepts like loops, variables and operators. Having given the test to other developers several times, I felt like a bit of hypocrite having never actually having taken it myself. I’ve also asked folks to complete the task in php, even though it wasn’t a language they were particularly familiar with. So, I decided it was time to end the hypocrisy, and give myself a little challenge:
Do FizzBuzz in as many languages as I could.
So, what did I learn?
- With the internet, you can learn the basics of most programming languages in about 5 minutes.
- Programming knowledge is portable between most common web languages. A loop is a loop, a variable is a variable, etc. Syntax for a task this simple can be learned in a few minutes.
- FizzBuzz can be done in sql, bitch.
- Clojure is hard for no reason.
- Lisp is basically impossible to get running.
- Languages have uptake because they’re included with the OS and have good documentation and communities. In the end, doing FizzBuzz in 10 languages took around 5 hours. There was, however, significant time taken for screwing around on Twitter, potty breaks, drinking too much coffee, curmedgeon-ing on StackOverflow, drinking beer, and making carnitas. Time was also spent looking for a way to run my FizzBuzzes in bash and benchmark them, which proved fruitless, since OS X doesn’t support nanoseconds in the date command.
For a closer look at the code, take a look at the github repo.