> It was designed as "This is one of the simplest possible programs one can write.
Weeellll, I mean it doesn't totally succeed in meeting that design criteria. Fizzbuzz weeds out three kinds of candidates:
- candidates who are (currently) unfit for any programming job
- candidates who freeze up during the interview
- candidates who have never used the mod operator
I fault fizzbuzz a bit, because there are candidates in that last category who have several years of experience successfully duct-taping together libraries to meet product requirements, yet panic because they've never had to find the remainder of division in their language of choice. They might be fine for the rec you have open.
A fizzbuzz with fewer false-positive rejections might be something like "implement multiplication without using the multiplication operator".
edit: Oooh! "How many ways can you implement multiplication" would be a much more interesting warm-up/weed-out question! Allows the quality candidates lots of room to shine.
> The famous fizzbuzz test simply asks "are you aware of the modulo operator?
No it doesn't. It could be implemented with counters you reset when needed. Didn't really read any further, I don't think this person should really be giving technical interviews anyway.
>If you skipped FizzBuzz and went with another programming exercise, e.g. giving some simple dynamic programming or reordering lists etc., would FizzBuzz actually be useful at all?
Both types of problems require a person be comfortable with arrays and iteration. It wouldn't be fair to give either of them to someone who can't get a simple for-loop right.
> Like I mentioned below, as a self taught web programmer, it was years before I came across a modulus in a real-world situation.
So? Like I mentioned in response to that, modulus isn't necessary for FizzBuzz.
> Again, just listing "HTML5, CSS3, JavaScript." by itself as a minimum qualification doesn't specify what level of knowledge is expected of you.
FizzBuzz doesn't require much depth of knowledge in the target programming language. If you are can handle assignment, addition, conditional logic, and any one of iteration, jumping, or recursion (note that some language may not support all three of those, so which are available depends on language), you can do FizzBuzz.
What FizzBuzz does require (assuming you haven't already studied it and memorized a solution in the language given) is being able to think through a dirt simple problem and apply a programming language to it. It identifies people with minimal programming skills as distinct from those who are limited to cargo cult copypasta (well, again, except that memorization means it can produce false positives.)
> I have no single idea what is FizzBuzz, and if someone asks me to do it an interview, I would fail miserably.
If you know what you are doing even in the slightest, you won't fail.
No one will put you next to the whiteboard and say "do FizzBuzz", expecting you to know exactly what it is and what to do. They will say "write a function that takes in a positive integer as an argument, and then counts from 0 up to that integer. Every time a count is divisible by 3, print out 'Fizz'. Every time a count is divisible by 5, print 'Buzz'. If a count is divisible by both 3 and 5, print 'FizzBuzz'".
I cannot imagine someone who wrote all the complex things you did, but is not able to write a toy counter function like that.
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).
> basic knowledge of fizbuzz, dfs, bfs, quicksort, and similar things of course is needed
FizzBuzz is not some arcane algorithm. You don't need to study it.
It's literally writing a loop, testing equality, and printing some output. I don't know how you could program professionally and not be able to solve FizzBuzz.
> Coding modulus from scratch with just + - / * is a fun little challenge in its own right, but it'll probably take you longer than 10 minutes to write it correctly and solve fizzbuzz with it.
I've seen numerous people fail on FizzBuzz despite supposedly being senior engineers.
None of them failed because they didn't know the modulo operator. For one thing, it's actually pretty easy to solve even without modulo.
If someone doesn't know modulo, I'll happily explain it.
More commonly, people struggle with even basic things like setting up a loop at all.
>Your garden variety web developer will not be building algorithms from scratch virtually ever.
Web developers like this are those that introduce O(n^2) complexity in places where it could be done in O(n), which makes for poor application performance. Sure, they aren't writing algorithms per se, but their lack of knowledge of algorithms still tends to create problems not-that-rarely (assuming the product is above certain size and complexity).
Also, what constitutes a "basic algorithm" is pretty vague. I've seen quite a few people interviewing who couldn't solve fizzbuzz. Until that moment, every time i heard about people not being able to solve fizzbuzz, I though it was an exaggerated joke to describe someone incompetent , but nope, plenty of people legitimately don't know how to solve it.
I don't think fizzbuzz could even be legitimately called an "algorithmic" problem, but no matter what, if you cannot just do a trivial for loop and a couple of if-elif-else checks, you are not qualified, algorithms or not. And there is no quicker way to filter those people out at the initial stage than a simple whiteboard problem.
I really struggle with the concept that some programmers cannot write FizzBuzz. I'd expect it from someone who has finished their first programming unit.
"When you really boil it down to its implementation, FizzBuzz is something of an irritating program. I’m not sure how much the author of the problem really thought about FizzBuzz, but it turns out it’s difficult to express well with the tools available to most imperative programming languages..."
Nonsense.. you call a simple loop with a couple conditions difficult?
I disagree. What's tricky about a naive solution for FizzBuzz? The only argument I could think of is "well it uses modulo which isn't all that standard". Not knowing modulo (or "how do I check if a number can be divided by another number") is a very bad sign (imo)...the rest is printing stuff, branching, a loop, methods/functions and getting a program to run (+maybe TDD). Those are all rather fundamental building blocks.
> FizzBuzz [...] You wouldn’t believe how many people can’t do it.
This is so true. IME, less than 50% of applicants can even get close. Mostly due to not remembering or even knowing about the modulo operator or a suitable workaround.
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!"
>The problem is that Fizzbuzz and string reversing are a kind of trick questions.
They are the exact opposite. They are practical, very simple, introductory questions. Fizzbuzz is literally "do you know what a loop and a conditional are?".
Weeellll, I mean it doesn't totally succeed in meeting that design criteria. Fizzbuzz weeds out three kinds of candidates:
I fault fizzbuzz a bit, because there are candidates in that last category who have several years of experience successfully duct-taping together libraries to meet product requirements, yet panic because they've never had to find the remainder of division in their language of choice. They might be fine for the rec you have open.A fizzbuzz with fewer false-positive rejections might be something like "implement multiplication without using the multiplication operator".
edit: Oooh! "How many ways can you implement multiplication" would be a much more interesting warm-up/weed-out question! Allows the quality candidates lots of room to shine.
reply