( You might ask what are the two twists in the original fizbuzz task:
- you have to know about the existence of modulo operator and how it can be used to test for dividibility. If you don’t know that one trick then fizbuzz is a lot harder for you.
- If you are the kind of person who translates the human sentences of the task description to code word by word then you can get into a kind of garden-path situation where you have to backtrack once to succeed. What do I mean by that? You read “For every number dividable by 3 print fizz”, you write “if i%3==0: print ‘fizz’”. Then you read the next sentence “For every number dividable by 5 print buzz” and you type “elif i%5==0: print ‘buzz’”. Then you read “for every number dividible with both 3 and 5 print fizbuzz” and you might translate that to “elif i%3==0 and i%5==0: print ‘fizbuzz’” but that of course would never execute, you have to move the translation of this last sentence to be the first condition checked for it to have a chance. Not anything I would call really challenging, but it requires a certain way of thinking to recognise that this is a problem and to solve it.
)
It's sad that Fizzbuzz is used at all. At present, using Fizzbuzz selects for people who either (1) Are math nerds or (2) Are already in the "in group" and possibly read HN. That probably makes a small contribution to the lack of diversity in tech.
Implementing fizzbuzz successfully requires someone to have the most basic understanding of cause and effect, the ability to reason from that understanding, and the ability to reason abstractly. Nearly all forms of programming require that. So yes, fizzbuzz selects people in the "in group"- the in group of people who are actually potential programmers.
It would be like testing if someone knows about a "crankshaft" in a job where they'll be exclusively working on Teslas.
Yeah completely agree. Not all things people call "programming" are the same. Only jobs that require someone to think in this way should have tests filtering for it
That may be true, but as a web dev, I use the modulo quite frequently. Just yesterday I used it to implement some code where the client wanted to insert ads after every sixth paragraph in a page body, but not if there would be two paragraphs or less left on the page after the last ad. I can't imagine what kind of goofy hackneyed solution I would have ended up with if I didn't know about `%`.
Before CSS had :even and :odd pseudoselectors, we also commonly used it to zebra stripe tables.
Web dev isn't typically as math-y as, say, game dev, but I'd encourage anyone getting into it to at least learn the modulo beyond basic algebra stuff.
2. It's an exceedingly easy exercise meant out to weed out those who plan to learn to code on the job and hop to a new one when they are busted.
They can probably still make a fizzbuzz, which puts them far above most candidates