What’s up with FizzBuzz post commenters?

Somehow FizzBuzz is still a topic today and that’s why I recently wrote a (satirical) post about it. Today I’ll describe the history of FizzBuzz and provide you with the links to the original articles. For anyone who does not know what FizzBuzz is, let me explain this first. Fizzbuzz is a programming test of a trivial algorithm that is supposed to be written with pen and paper (without using a computer). Many programmers fail this test during interviews. What that means? No idea… really… I don’t.

What’s wrong with FizzBuzz?

I believe in programming tests in the interview process, but not in the “trivial algorithm with pen and paper” type. In my opinion the following is wrong with the FizzBuzz test:

  1. No Google or other tools
  2. Being overlooked while writing
  3. No way to run the code (or check the syntax)
  4. No text editing (insertion/modification)
  5. Algorithm is trivial

To me, these differences with programming in the office make FizzBuzz a test that has nothing to do with the actual creation of software. Although I have no data to back it up, my feeling says that FizzBuzz success DOES correlate with programming experience. But programmers that are good at memorizing syntax are far less valuable than those solving non-trivial algorithms. Since FizzBuzz rewards only the first, I think it is flawed. So it is a bad test, so what?

Those comments… why?

Well, before we skip to the history of FizzBuzz I have one question about these posts that I want you to help me answer:

“Why do people post answers (code) to FizzBuzz articles in the comments?”.

Aren’t you disqualifying yourself by posting the answer to FizzBuzz? I feel you are saying “the answer is interesting” or “look, I can solve it!”. What’s up with that? Some people post answers in obscure languages, which I also do not understand. What is that supposed to mean? Does it mean “this obscure language can be used to solve this trivial problem” or “I know this obscure language good enough to solve a trivial problem”? Or, more understandable I guess, are all these reactions trolls to invoke a reaction? If that is the case, then what is the desired reaction?

One commenter (EdwardM) writes:

And, just because I’m a geek, and can’t help myself, here’s what I whipped up in a couple of minutes. I’m sure it could be better, but that’s when you start up an interesting conversation about refactoring in the interview, right? 😉

He knows it is wrong to post the answer, but still he does it. Is it the urge to share? The urge for recognition? Maybe that is all not true. Maybe I am too negative and is it a positive thing. Maybe it is fueled by the “joy of programming”, can that be it?

History of FizzBuzz

Okay, now as promised the first three posts from 2007 that started the whole FizzBuzz discussion in the first place:

  1. Imran Ghory: Using FizzBuzz to Find Developers who Grok Coding
  2. Reginald Braithwaite – Don’t Overthink FizzBuzz
  3. Jeff Atwood – Why Can’t Programmers.. Program?

Other interesting links on the topic:

Read them, but remember: beware of the comments! 😉

Share

How to win a senior programmer job interview

This post will give you 3 advices that will help you to win any job interview for a senior programmer position. It does not matter that you can’t program when asked during the interview, just follow these simple advices and you are one step closer to being a rockstar software developer earning big bucks!

Advice 1: Learn the Fizzbuzz answer

Most interviewers ask the same question to measure programming skills: program Fizzbuzz. It is a very popular, but extremely tricky assignment that even the most skilled programmers fail at. Just learn the code in the required language by hearth and you will fool any interviewer. Note that you really don’t have to understand the code as the explanation of what the code does is given in the assignment.

Java implementation (Fizzbuzz)

public class FizzBuzz {
	public static void main(String[] args) {
		for (int i = 1; i <= 100; i++) {
			if (i % 15 == 0) {
				System.out.println("FizzBuzz");
			} else if (i % 3 == 0) {
				System.out.println("Fizz");
			} else if (i % 5 == 0) {
				System.out.println("Buzz");
			} else {
				System.out.println(i);
			}
		}
	}
}

PHP implementation (Fizzbuzz)

<?php
for ($i = 1; $i <= 100; $i++)
{
    if (!($i % 15))
        echo "FizzBuzz\n";
    elseif (!($i % 3))
        echo "Fizz\n";
    elseif (!($i % 5))
        echo "Buzz\n";
    else
        echo "$i\n";
}

Python implementation (Fizzbuzz)

for i in xrange(1, 101):
    if i % 15 == 0:
        print "FizzBuzz"
    elif i % 3 == 0:
        print "Fizz"
    elif i % 5 == 0:
        print "Buzz"
    else:
        print i

C implementation (Fizzbuzz)

#include <stdio.h>

int main (void)
{
    int i;
    for (i = 1; i <= 100; i++)
    {
        if (!(i % 15))
            printf ("FizzBuzz");
        else if (!(i % 3))
            printf ("Fizz");
        else if (!(i % 5))
            printf ("Buzz");
        else
            printf ("%d", i);

        printf("\n");
    }
    return 0;
}

Advice 2: Learn the “100 to 1” answer

A very smart interviewer has come up with an alternative to the popular FizzBuzz assignment called “100 to 1“. Probably because the FizzBuzz answers got really easy to Google. The assignment is to print a count down from 100 to 1 using a “for” loop that has a loop variable “i” that starts at 0. This blog has gotten exclusive access to the secret answers to this very hard and brand new assignment. Use them in your benefit!

Java implementation (100 to 1)

public class HundredToOne {
	public static void main(String[] args) {
		for (int i = 0; i < 100; i++) {
			System.out.println(100-i);
		}
	}
}

PHP implementation (100 to 1)

<?php
for ($i = 0; $i < 100; $i++)
{
    echo (100-$i)."\n";
}

Python implementation (100 to 1)

for i in xrange(0, 100):
    print 100-i

C implementation (100 to 1)

#include <stdio.h>

int main (void)
{
    int i;
    for (i = 0; i < 100; i++)
    {
        printf ("%d\n", 100-i);
    }
    return 0;
}

Advice 3: Failure defense and contract extension

If you make a mistake, then don’t worry. Claim it is due to test anxiety. Another great defense is that you could not solve it, because you rely heavily on your favorite IDE. If that does not work, then you can say that the assignment seemed so trivial to you that you could not believe it was the actual assignment and you were looking for the hidden “difficulty”. One of these will work every time, guaranteed!

Some people have commented that they are worried about being outed as an impostor as soon as they won the job. Don’t be! By the time you are “up to speed” you are already earning big bucks for a few months and you have passed your trial period. Also, by posing humble, showing your effort and indicating that you are having trouble “adapting to the working environment” or “finding your spot in the team” you can probably achieve to win a contract extension.

Conclusion

It is important to realize that you can become good at winning a senior programmer job and also that being a great programmer is not always the easiest way to win it. Be aware that there may be some luck involved as not every interviewer asks the right questions (the ones above) or is sensible enough to buy your defenses (if you even need these). Don’t be discouraged if you do not succeed at once. There are enough companies eager to hire senior programmers, so you can have many chances as they interview anyone who sends them an impressive CV.

Let me know if it worked for you! Or maybe don’t… as I would become really depressed if it did (as this is a satirical post). 😉

Share