3 ms·
"If you don't know about your preferred language's modulo operator..." Do you know your language's modulo operator? I went down a rabbit hole the other day por
by perl4ever 7y ago
"If you don't know about your preferred language's modulo operator..."
Do you know your language's modulo operator? I went down a rabbit hole the other day porting some Python code to another language and discovered that modulo acts differently in different languages for rather subtle reasons.[1]
It took me, frankly, more time and iteration to implement Python style modulo correctly than I would have in an interview, or be able to muster while conversing with someone.
[1] https://en.wikipedia.org/wiki/Modulo_operation https://en.wikipedia.org/wiki/Modulo_operation (see the table on the right)
- gjm11 7y agoFor Fizzbuzz purposes, you only need to know what happens when both numbers involved are nonnegative, which so far as I know is consistent everywhere. (I deal with the other cases by making sure only to use % or similar on nonnegative numbers. If I ever encounter a case where I need to take remainders and performance is so important that I can't afford to do that, I'll double-check with the language documentation and leave a comment saying what the actual behaviour is. That's never happened yet.)
- perl4ever 7y agoIt's pretty common for people to be very focused on the trivia they know as a litmus test for judging other people, while dismissing trivia they don't know as irrelevant. I don't have concrete reasons for thinking so, but my general impression is that this attitude is significantly more common in IT than other environments.
- Doxin 7y agoIf I was interviewing someone I'd not count a mildly buggy fizzbuzz against them, especially if it's a whiteboard interview. Really all I'm looking for is for someone to conclude based on the problem description they at the very least need a for loop and a couple if statements. It's not a test to see if you can program well, it's a test to see if you can program at all.
- perl4ever 7y agoI was searching for words to express why people may find FizzBuzz antagonistic... People make mistakes on everything,[1] no matter how trivial. Therefore, it can be threatening to even a genuinely competent person to be judged on a really elementary task, because even though it is simple to do, the margin for error is correspondingly small. The easier it is, the less excuse for any hiccup. Of course, you just said you are not judging on minor issues, but it's hard to believe even assuming your best intentions. The simpler a task, the more judgmental human nature compels one to be, and the more confirmation bias will work to magnify any later errors. [1] https://en.wikipedia.org/wiki/Muphry%27s_law https://en.wikipedia.org/wiki/Muphry%27s_law aka Skitt's law