Whiteboarding (asking a candidate to write code on a white board during an interview) is a waste of time. Without going too much into the reasons and because enough was said already, I just want to highlight that this exercise is nothing like the Software Engineering job. Never in my 20 years in the industry I've seen anyone to write code on a white board. The actual code, with all its brackets and semicolons. I've been to Google's office with it writable walls everywhere - and seen no code. Nobody does that.
But Software Engineers constantly work with others code. We do code reviews every day. We dig through open source libraries. We suggest patterns to use. This what I've been using lately during the interviews.
I would give a candidate a few sheets of paper with real code on them. I would be using real world open source code, preferably a small one. There would be no missing commas. The code compiles and runs fine. But it is always wrong. Then I would ask the candidate to do a code review.
Going through this exercise provides a ton of information.
Does the person grasps the intent right away? This is a way better sign of the actual programming abilities than the speed of writing yet another breadth-first tree traversal routine.
Does the person starts from the small things - variable names and such - or from the big architectural observations? This will tell the style. Not that one is better than the other. But knowing which way the person approaches a new problem is invaluable.
And once the person inevitably suggests to refactor the code, you have a great conversation about the pros and cons of various patterns. Way better way to learn a developer's level, than observing her struggle to remember the order of arguments of memcpy() or java.lang.System.arraycopy().
To give an example of the code I would use, consider this Apache Kafka class
It is just under 300 lines of code, containing 4 (!) classes and countless problems. It starts from the eternal "why messaging system has a Shell Execute feature at all?", and goes on into weak error handling, excessive buffering, mix of modern and deprecated classes (StringBuilder and StringBuffer both in the same file?), invalid escape routine in toString() and a method of capturing stderr copy-pasted from StackOVerflow (instead of using redirectErrorStream(true)).
Would your candidate write 200 lines of code on a white board? Of course not, it is not going to fit.
Would you have as much material for conversation? Would both of you be free of an adversary situation? By that I mean that neither of you is criticizing each other and hopefully neither feels an urge to defend any particular line in the code.
This has worked really well for me recently. So well, that I completely forgot all about the horrors of whiteboarding. Until I was asked to go through it recently. I had 4 whiteboarding sessions, all solving extremely boring and trivial problems while being grilled for the missing semicolons, variable names and such. If you ever seen my handwriting, especially on a whiteboard, you would understand that interviewers had hard time following what's written on the board. The best bit was when I wrote a unit test in Groovy for some Java code. The interviewer was totally in the dark. What's invokedynamic? Does this even compile? Wait, no interface or an abstract class needed to accommodate a mock in the unit test? This can't be right. If there was an IDE, I could've run it and showed it to him. But it was just a whiteboard and he left the room shaking his head.
I walked out of the sessions knowing that I will not be back. Not only because of the whiteboarding of course. The company managed to loose my CV along the process several times and totally butchered the interview day. The recruiter was not even there. The interviewers were absolutely unprepared for the interview and were asking the questions from the list - constantly worrying about repeating a question already asked. Not a single one of them had any spark of interest in me, code or the questions. It was like a dental appointment. It feels good when it's over.
This kind of a company does whiteboarding. Would you want to work for one?