Friday, March 2, 2007


Not too long ago Imran gave the world FizzBuzz. FizzBuzz is an incredibly easy programming problem whose sole purpose is to screen software development job applicants who are so bad that they can't write code at all. It has no other purpose. It was literally designed so that it requires programming skill, but if you have any programming skill at all, you can solve it in seconds.

You might expect the blog world to respond, if it responded at all, with a re-evaluation of its hiring priorities, or a re-examination of the ways in which software developers are hired, or even some new ideas about how to hire. Alternatively, if you were absurdly cynical, you might expect programmers to start coding FizzBuzz in every language from Haskell to SQL, and even to start holding FizzBuzz coding contests.

The great thing about being cynical is, it's rarely disappointing. Anybody who makes a prediction that large numbers of humans are going to continue acting like idiots will always get to enjoy the satisfaction of seeing their prediction come to pass. Because this is what people in fact do.

Anyone hoping to stop the madness is facing the usual frustration experienced by those who attempt to get more than three people to use their common sense in the same place at the same time. There was recently a post about a FizzBuzz contest on the Ruby-Talk mailing list which actually linked to Raganwald's Don't Overthink FizzBuzz for a description of the problem. (The FizzBuzz golf contest site appears to be down, but here's the link anyway.)

There is probably nothing more useless than coding a solution to FizzBuzz. It is not a profitable problem; it is not a difficult problem. You will learn nothing, you will not make a cent. The sole purpose of this programming problem is to weed out coders so incompetent that they have no hope of ever learning to program anything. It is only useful to people who hire programmers. Yet programmers are coding it in droves, all over the Web. It's even being called the programmer's "Stairway to Heaven," except that's completely wrong, because playing "Stairway to Heaven" does require some practice and skill.

Obviously I'm just complaining about people being stupid, which is of course at least as unproductive as the actual stupidity itself. But the funny thing is, I think you can use FizzBuzz as a hiring screen in another way. Don't ever hire anybody who can't code FizzBuzz; and don't ever hire anybody who does code FizzBuzz. Because the question is, why has anybody ever coded a FizzBuzz implementation? You get no money, you learn nothing, you don't get laid, you don't get a cookie, you don't even get to wear a shiny paper hat. (Although I suppose nobody's stopping you.) What on earth is the point?

People code FizzBuzz because it's safe. Every programmer out there who has wasted a second of their time on a FizzBuzz implementation has had something better to do, some dream, some goal, some ambition that they passed up to write FizzBuzz instead -- just like everybody out there who's ever sat on the couch and watched Friends instead of doing something worthwhile with their lives. They read about it on the Internet, it involves some form of effort -- insofar as lifting your fingers and then dropping them on a keyboard must burn some fractional quantity of a calorie -- and it's a lot less frightening than taking that dream program you've always wanted to code and actually coding it. (Or worse yet, making a first pass at it, realizing it sucks, throwing it away, and starting again. Which is what you have to do if you want to get anywhere.)

The thing is, if you've got some person who really thinks that coding FizzBuzz is worth the time it takes out of their short life, the few inches it brings them closer to the grave, they're going to be that wasteful with your time too. Even after you've bought that time from them. Hiring somebody who spends the time to write a FizzBuzz means that the thing you hire them to write will turn into a FizzBuzz. Those FizzBuzzers will FizzBuzz it up, until it's so damn FizzBuzzed that nobody but an utter FizzBuzz would be willing to work on it in the first place.

Keep in mind, FizzBuzz is basically an idiot detector. Anybody who bothers to code FizzBuzz is saying, ooh, an idiot detector. I'd better aim this at my own head and see what happens. Then they manage to code FizzBuzz and they go, "yay! I'm not an idiot!"

At the risk of raining on their parades, if you aim an idiot detector at your own head, it really doesn't matter what the readout is.


  1. To the contrary, I have been enjoying the fizzbuzz movement. First of all, of course programmers are going to solve FizzBuzz. Hackers are problem solvers and it's hard to resist that urge. Since when does uselessness enter into it? Some guys at SAP just used scriptaculous and rails in order to create a web app with which they could modify backend data using a wiimote. Not much of a business case there, but I'd sure hire those guys on basis of the passion and skill required.

    More importantly though, I think that programmers are used to being idiots *somewhere*. Of course I can hack fizzbuzz in a minute in any language on my resume. But there are other languages. I found myself reading through implementations, looking at idiomatic solutions in languages where the idiot detector would go off when pointed at me. Like a rosetta stone, you know the message and seek the cipher.

    Is Fizzbuzz the best rosetta stone out there? Better than some, worse than others. There's iteration, conditionals, string output. I'd say that puts it above hello world, and in the vicinity of fib(x) on the rosetta stone scale.

    Anyway, I'll get back to work in a minute, hacking something much more useful to my client but still rather unimportant in the grand scheme of things. I guess I feel the same about coding as I do about my weekend pick-up sports matches: "We come to have fun, not to win."

  2. It seems like everybody's been enjoying FizzBuzz more than I have. I just posted in my tumblelog a link to a programmer who solved FizzBuzz by writing a solution in Lisp, a Lisp interpreter in Lisp to run the solution, a Lisp interpreter in Prolog to run the Lisp that runs the Lisp that runs the solution, and a Prolog interpreter in Ruby to run the Prolog that runs the Lisp that runs the Lisp that runs the solution.

    I can see people are having fun with it, but it still seems kind of insane.

  3. I can see people are having fun with it, but it still seems kind of insane.

    Perhaps there is the great divide.

    I agree that it is inane, but dispute that it is insane.

    But I am mystified as to how much attention it has gotten. When I posted a contrived solution, I did so to illustrate that it was not worth taking any more trouble to solve than necessary in an interview.

    My injunction was not to over-think the darn thing, but somehow...

    What is sad is how few people wrote to give their code for implementing fixed point combinators, bayesian classifiers, or lazy evaluation. What is it about Rod Stewart that fascinates while Roy Hargrove walks down the street unrecognized?

  4. I just posted in my tumblelog a link to a programmer who solved FizzBuzz by writing a solution in Lisp, a Lisp interpreter in Lisp to run the solution, a Lisp interpreter in Prolog to run the Lisp that runs the Lisp that runs the solution, and a Prolog interpreter in Ruby to run the Prolog that runs the Lisp that runs the Lisp that runs the solution.

    Wow! That would be something worth looking at.

    I agreed with your post here that while I could've coded FizzBuzz in short order in the language of my choice, it wasn't worth my time. It would've been the equivalent of writing "Hello World". Why would I bother writing something I could do in my sleep?

    I put forward a challenge in C, on the same blog: convert an integer to a string--using no library functions. It uses the same functionality tested for in FizzBuzz. It would be trivial to write a solution to it in a dynamic language like Ruby (because there are different rules). No one responded to it. Maybe it seemed too trivial.

  5. FizzBuzz definitely has hit the tipping point. I think it's probably more a sociology question than anything else.

  6. I'm guessing that you probably also think codegolfing is insane, but I posted the FizzBuzz problem at because there's more to this than "can you write it?". Of *course* everybody can write it. But can you do it in less than 56 bytes of Ruby, or 91 bytes of Haskell, or 62 bytes of Postscript?

    Assuming one has the good judgement not to try put that kind of squeeze on normal code, I tHink golfing a simple problem can serve as a kind of code kata. Learning edge cases is part of really knowing a language, and a quest for minimum size sure does locates some edges.

    Also, the golfing competition clearly drew many people who would otherwise have posted their damned solutions in blog comments, so *somebody* should be thanking me for that at least.

  7. I was a little disappointed you didn't end your post with your own FizzBuzz attempt. ;-)

  8. I once worked with a guy who won an obfuscated Perl contest by writing an incredibly tiny Morse code interpreter, and then writing the rest of the program in Perl. Or possibly by writing a Morse code interpreter in Morse code in Perl. He was a smart guy and I was definitely glad to work with him. Code-golfing and obfuscation contests aren't necessarily a bad thing, but FizzBuzz really isn't worth that kind of attention. I'm just saying, have a sense of proportion.

  9. @jim -- maybe I'll code a FizzBuzz this weekend, which works by overriding Integer#to_s in Ruby, and then does 1..100.each {|i| p i}.

    Probably, though, I won't.

  10. Write something else. Thanks! Best Blog...

  11. Well done. Keep up the great work. Best regards!

  12. I like it a lot! Nice site, I will bookmark!

  13. Thanks to author! I like articles like this, very interesting.

  14. Disaster is likely to wreak havoc in the life of an individual as soon as he becomes victim to erectile dysfunction and the most significant dreadful consequence of erectile dysfunction is that the afflicted man becomes incapable of facilitating erections required for sexual intercourse. The sexual vacuum resulted from erectile dysfunction prompts the sufferer to opt for anti-impotency pills, most especially the viagra medication that was approved by FDA (Food and Drugs Administration) as a clinically effective drug to cure erectile dysfunction in men. Viagra is meant to be administered by patients only after availing of viagra prescription from the doctor. The prescription for Viagra provided by the doctor spells out that the patient suffering from erectile dysfunction seriously need Viagra to treat his disorder and further authorizes the patient to avail of Viagra from the pharmacist.

  15. Your opinions could also be applied to those who blog about FizzBuzz. What lofty goal did you put off writing this blog entry?

  16. Viagra
    Generic Viagra


Note: Only a member of this blog may post a comment.