Posted by & filed under , .

I came across an interesting article today on weeding out weak programmers. Simply ask them to program FizzBuzz.

Using FizzBuzz to Find Developers who Grok Coding

FizzBuzz is a game children play in the UK where they each sit is a circle and begin to count. The catch is that if the number is a multiple of 3 you have to say ‘Fizz‘, if it’s a multiple of 5 you say ‘Buzz‘, and for multiples of both 3 and 5 you have to say ‘FizzBuzz‘.

Supposedly many computer science majors and other applicants for programming jobs can’t do this simple task.

On occasion you meet a developer who seems like a solid programmer. They know their theory, they know their language. They can have a reasonable conversation about programming. But once it comes down to actually producing code they just don’t seem to be able to do it well.

You would probably think they’re a good developer if you’ld never seen them code. This is why you have to ask people to write code for you if you really want to see how good they are. It doesn’t matter if their CV looks great or they talk a great talk. If they can’t write code well you probably don’t want them on your team.

After a fair bit of trial and error I’ve come to discover that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

FizzBuzz sets out such a simple task that anyone who can program should be able to write up a code that can do this in a couple of minutes. It’s amazing to hear that many of the applicants who apply for a programming job aren’t able to do this.

Perhaps the question is too easy. At first I thought there had to be some sort of catch to it. A trick question. But no, it is that easy. Simply write a program that will count from 1 to 100 replacing multiples of 3 with ‘Fizz‘, multiples of 5 with ‘Buzz‘, and multiples of both with ‘FizzBuzz‘. No tricks. No hidden catches.

So naturally as a programmer myself I immediately had to set out to prove my competence by writing FizzBuzz in PHP. While my design is far from elegant, I assure you that it works, which puts me in that club of programmers who can program.

$multiplesofthree = 1;
$multiplesoffive = 1;

for ($i=1;$i<=100;$i++) {
if ($multiplesofthree==3 AND $multiplesoffive==5) {

} elseif ($multiplesofthree==3) {

} elseif ($multiplesoffive==5) {

} else {
$tehprintout = $i;

echo “$tehprintout

Article: Why can’t programmers.. Program?

Be Sociable, Share!

You must be logged in to post a comment. Log in