People really need to stop lumping fizzbuzz into their hatred of "trivia" questions. You don't do variations of fizzbuzz. Fizzbuzz is not a challenge, it is not trivia, it is not a trick question or a brain teaser. It is the simplest, most inane function you can ask someone to write. It exists purely to filter out people who simply can not write any code at all. It is a test of "does this person understand the concept of a loop, and the concept of a conditional". That is it.
Fizzbuzz isn't a trick questions that you have to have heard of. It's designed to be an EXTREMELY easy question, answerable by anyone with even a basic knowledge of programming. It's not a game. It's a way to weed out people that don't know anything.
If you have been programming for 35 years, you'll probably be appalled by how easy it is. Look it up.
Fizzbuzz is a trivial test to detect people who are basically fraudulent in their claims of programming ability. You shouldn’t need to study for it. Sorting algorithms, sure.
You say you don't agree, but you don't disagree either. Perhaps you should know a modulo operator but that's still not what FizzBuzz is for. It's to see if the candidate has the most basic concepts of loops and tests.
Adding knowledge of a relatively obscure operator (can't remember the last time I needed it in real life) just makes it a trivia test.
I mean I would even consider fizzbuzz a riddle. It’s one of the simplest programming tasks I have ever been asked in a technical assessment. Do you have a preferred alternative?
I don't ask multiple questions like FizzBuzz, but I do ask for FizzBuzz. (I will explain the modulo operator if necessary because it doesn't come up that often in web development and people many forget about it until prompted.) Everything else about FizzBuzz (loop over a range, use a conditional, define a function, compare, etc.) is so basic you would think you wouldn't need to test it - but then you run into a person with 10 years experience who can't do it.
It's a (sadly) useful screen. Even more sad when you realize how popular and widespread that particular question is.
Just to state the obvious but all fizzbuzz really tests for is whether someone is familiar with the modulo operator or not. Arguably any good programmer should know about it, but I think it's not a very comprehensive check on the knowledge of any one particular individual. Suppose for instance, that the only bit of code someone has ever written was something which required them to get very familiar with the modulo operator, but virtually nothing else. They could pass fizzbuzz, but not much else.
Note: The author of the 'non-programming programmer post' saw took my comment down when I had posted it there (which is why I posted it here). Guess there's no knocking of the fizzbuzz test allowed... :p
Who cares the about what FizzBuzz REALLY is? Can't we all just agree that it's a programming test because anybody who calls them self a programmer should possess these painfully simple analytic skills. If you can translate pseudocode to code, but can't write pseudocode for FizzBuzz, you're a translator not a programmer.
Jeff himself said, rather horrified when people started posting solutions to FizzBuzz:
> FizzBuzz was presented as the lowest level of comprehension required to illustrate adequacy. There's no glory to be had in writing code that establishes a minimum level of competency. Even if you can write it in five different languages or in under 50 bytes of code.
> The whole point of the original article was to think about why we have to ask people to write FizzBuzz. The mechanical part of writing and solving FizzBuzz, however cleverly, is irrelevant. Any programmer who cares enough to read programming blogs is already far beyond such a simple problem. FizzBuzz isn't meant for us. It's the ones we can't reach-- the programmers who don't read anything-- that we're forced to give the FizzBuzz test to.
I think that mentioning it as a skill (unless it's in jest), seriously hurts anyone's chances at being taken seriously. Exactly like someone would be dubious if their carpenter said "I can definitely make that cabinet for you. Hell, I can screw and unscrew!"
This was literally part of my first programming assignment in college. Can people really not do this? Isn't fizzbuzz considered too obvious these days? I feel like I must be misunderstanding...
What "simple trick"? The original point of FizzBuzz is not to check that the interviewee produces hyper-efficient code that avoids repeating the divisibility checks (or, for that matter, to check that they repeat the divisibility checks and are able to defend why that's simpler). It's to check that they can write down any solution at all (within reason [1]). Doing that doesn't require any tricks; you literally just need to write down the requirements in the form of code. Unless you count for loops as tricks! I know the guy who came up with FizzBuzz [2], and he did so to root people who couldn't code at all, not those who weren't good at coming up with (or memorising) coding tricks. Or, if the "trick" you're talking about is memorising, verbatim, a simple for loop solution to FizzBuzz without understanding it, then that can be countered with small variations of the problem.
I agree that some interviewers pose questions that are too hard, which ending up testing ability to perform in an unrealistic situation more than actual programming competence. Of course this happened before FizzBuzz existed. Similarly some probably set a straightforward FizzBuzz and overanalyse details rather than worrying about whether it works (or worry about silly syntax mistakes, which are perfectly reasonable on a whiteboard).
I have to protest, Fizzbuzz is not a puzzle! There's no trick! The entire algorithm is given by the problem description!
If you allow people to google it, you allow copy-paste-coders to pass the test, and you don't want that.
Solving it requires a loop, some conditionals, and some print statements. If you can't write that from scratch, then you can't program. At all.
Also, writing code or pseudo-code on a whiteboard is something we do pretty often at work, I don't think it's an unrealistic demand that your coworkers should be able to join in on such a discussion.
That's another good point, fizzbuzz really tests two things, and people tend to only think of one of them. The first one everyone thinks of is "does the person know how to write a simple if/else expression". But the other thing people need to know is how to do math, and use programming syntax, they haven't thought of in potentially a very long time.
It would be like testing if someone knows about a "crankshaft" in a job where they'll be exclusively working on Teslas.
FizzBuzz is not aimed to find the best, the kind of people who fail fizzbuzz don't fail it for syntax errors or semicolons. People fail fizzbuzz by staring blankly at the screen/whiteboard acnd not nothing where to start, you fail fizzbuzz by not knowing how to do a loop. You fail fizzbuzz by nkt knowing how to do an if statement, you fail fizzbuzz by not knowing about modulo arithmetic. Fizzbuzz is designed to get rid of those people.
reply