3 ms·
How do you ask people to "solve FizzBuzz" and how do you know they've solved it? I'm asking because if you do a whiteboard test then it's easy enough to get th
by YeGoblynQueenne 11y ago
How do you ask people to "solve FizzBuzz" and how do you know they've solved it?
I'm asking because if you do a whiteboard test then it's easy enough to get things wrong on both sides of the interview. Humans are just not as accurate as compilers, not even for the simplest of things.
Besides that there's always nerves, misunderstandings, cultural differences etc. In one place I interviewed they asked me to write a factorial method in Java. I assumed they wanted a recursive method, because, factorial, right? Classic recursive example. So I gave them a recursive factorial in Whiteboard Java™. I turned around from the whiteboard to see the interviewers staring at me, their mouths hanging open. And not in a good way. It turns out all they wanted was to see if I could write a simple loop. Instead of marvelling at my amazing recursion powers, they got the impression I was needlessly flashy and probably had my head up my arse. Also, seeing them staring I completely panicked and I totally screwed the iterative version: the loop went up instead of down, I was adding where I should be multiplying... a shambles.
So they didn't hire me.
Shit happens in interviews and it's not because "Johnny can't program". It's because "Johnny can't pass a programmign interview" (or at least many of them).
- _Codemonkeyism 11y agoI usually do them online with an editor like etherpad. I tell people they can use the language I hire (Ruby,JS,Java) but I'm fine with other languages or pseudo code. I tell people I don't care about semicolons or braces, I don't hire them for being a compiler. Factorial I also use sometimes. Recursive is fine with me if it works, I've seen many people to go the recursive way - hey it's factorial - and then screw up. I sometimes ask people to do an iterative solution, or I ask if the recursion went flawless to write it as tail recursion.
- YeGoblynQueenne 11y agoCompilers don't just catch syntax errors though - they also show up logic errors, that may be too subtle to see on a whiteboard. That's true even with very simple programs. You can definitely step through your program by hand and follow the logic etc, and you should totally be able to do that, but most programmers will not be in the habit of doing this. And neither should they, because it's slow, tedious and error-prone to hand-simulate your algorithms, or even just your for-loops. Not to mention recursive, or larger stuff. I guess what I'm saying is that programmers are used to "lean on the compiler" and you don't have that on a whiteboard exercise, so it's a bit artificial. [Full disclosure: I'm in the habit of hand-simming my stuff especially in the last year where I've been developing a grammar induction algorithm, so I'm not worried that I'll have to stand on a whiteboard and not know how to step through a loop, but I still think it's not very useful to make people do that).
- golergka 11y agoFactorial recursion solution is flashy? It's supposed to be high school level stuff.
- YeGoblynQueenne 11y agoThey were expecting an iterative solution, so giving them a recursive one came across as a bit snotty. As it should. What language did you do your high-school level stuff in? I assume it wasn't Java, because in Java there are no good reasons to use recursion (it provides iterative primitives, unlike say Haskell, Prolog, Lisp etc) and there are good reasons not to (its compiler doesn't (or didn't) do tail-call optimisation). Not to mention, any language without pattern matching is a bit shit for teaching recursion anyway: you tend to miss the point because of all the bookkeeping.
- golergka 11y agoPascal and lisp-like language that was created for teaching purposes in our school. Still, recursion was among the first procedural programming topics, right after procedures themselves, if I remember correctly.
- YeGoblynQueenne 11y agoPascal and lisp-like? What school was that, or rather -when was that? Recursion is generally considered hard by most programmers, hence why my interviewers thought I was showing off. You can google a bit and see that people do indeed have trouble getting their heads around it.