Take the 2-minute tour ×

Recently I heard of a company that, for interviews, asks potential employees to stand up and write out code on a whiteboard. Apparently that freaked alot of interviewees out.

This got me thinking and even though I consider myself a reasonable programmer, I would be hard pressed to write lengthy code out without referring to previous code I had written or doing a quick Google search.

How many programmers could safely say "Yes I could write all my code out just like I was writing an email"?

share|improve this question
I doubt that you would have to write anything on a white board that would require the need for references. –  Pemdas Jan 26 '11 at 17:24
Well you dont know do you? Could be a cruel interviewer? –  benhowdle89 Jan 26 '11 at 17:27
I have had to do this many times in interviews. Sometimes a SQL statement, sometimes a full method. It's not all that difficult, and it give you a chance to walk through your solution and your thought process while writing it. Sometimes, if you don't know the method you can just write pseudo code and comment that you'd have to look up the specific call/syntax. –  Tyanna Jan 26 '11 at 17:30
Cool Tyanna thats good to know! –  benhowdle89 Jan 26 '11 at 17:34
Oh man, I suck at poetry ... three out of three girls that I wrote poems for asked me not to do it again. What am I to do now? –  Job Jan 26 '11 at 17:48
show 3 more comments

7 Answers

up vote 11 down vote accepted

As an interviewer asking for white board coding, I wasn't looking for perfect syntax and I was asking questions about basic algorithms using arrays or strings. I was looking for the kind of knowledge a college kid should have after watching a professor write code on a chalkboard. Not that most professors do that any more, since they all use PowerPoint, but back in the day I promise they did.

Whiteboarding code did seem to freak some of my interviewees out, but in that case I tended to try and talk them through it. All I wanted to see was that they could write code. Since my company didn't take code samples, and since I wasn't the hiring manager dictating how the interview went, this was my best bet for getting that information.

As an interviewee I was interviewed by a Very Big Company whose technical interviews are all whiteboard. I had read on blogs and in articles that for this Very Big Company you had to start off with a moderately optimized answer as opposed to the brute force attack and you had to have perfect syntax. The people writing this on the internet must have gotten the though interviewers and I must have gotten the easy ones, because my experience was that the whiteboard coding was viewed as a thinking tool in the interviews just as it would be in real brainstorming with your team.

Perhaps there are interviewers out there who demand perfect and at least somewhat optimized code on the whiteboard as if it was flowing straight from your stream of consciousness. Really, though, if a person is demanding such things do you want him or her as your co-worker? If so, great. If not, perhaps it isn't so bad if you can't write code like prose.

I wouldn't freak out about writing code on a whiteboard in an interview, though. Just do your best to solve the problem with the tools you have. Interviewers like me are rooting for you to solve the problem as much as you are.

share|improve this answer
add comment

Last year, I had an interview that featured not only coding on a whiteboard but also developing an actual working application. I was given a laptop with Visual Studio, a connection string for a database and was told to develop a web service that exposed the database and WinForms front-end to query via the web service.

I didn't think a thing of it -- besides the fact that it was the most thorough interview that I'd ever had -- and it wasn't a big deal. Companies that interview this way are generally looking for productive, hands-off engineers, and unless a candidate can demonstrate that he or she has enough mastery of the subject matter to be able to discuss and use it extemporaneously, they are not going to fit that criteria.

Now, there are plenty of competent engineers who are just going to get plain nervous in this circumstance and they will make mistakes. If the interviewer fails to recognize that, both sides lose out, but what are you going to do? The interviewer has to do something to get a reasonable level of confidence that the interviewee's resume and answers aren't made up bullshit. Usually, a faker will get caught before long, but as an employer, you don't want to waste any of your time and money sniffing out a BS artist.

So I can't see any problem at all with whiteboarding code in an interview.

share|improve this answer
add comment

In my opinion, the interviewer is not looking for the solution to the problem which is free from language syntax error or clean code. Instead, they are trying to understand your thinking pattern, which includes,

  1. How you break the complex problem in to series of simple problems.
  2. How you handle the stress.

These 2 things differentiates the great and average programmers. Hence if you attend such interviews, just play it cool and don't worry about the language syntax.

Good Luck,

share|improve this answer
add comment

I don't think it's important that you be able to write perfect and compilable source code like prose, on a whiteboard. I do think it is important to be able to write clear and comprehensible pseudo-code/algorithms like prose on a whiteboard (maybe with bits and pieces of real code thrown in when applicable).

share|improve this answer
add comment

The questions asked in an interview for a white board should not be on such a level that a programmer who knows what they are doing would have to refer to old code.

One of the main purposes of such a question is to see how you work and how you present code and solutions. If someone is not able to present a solution to a problem on a white board effectively with real code, then that it typically a negative, especially if the position involves working with other programmers.

share|improve this answer
add comment

I hope I wouldn't have to write a connections string to a DB 4 file, but some basic coding should be expected shouldn't it? I'd ask an accountant or financial analyst how to write an if statement in an Excel formula.

Maybe to be fair, you could get a sample of their code and ask to rewrite a piece for a specific need.

Not sure I would hire someone who couldn't demonstrate their work and hopefully discuss it.

share|improve this answer
Poor analogy, asking an accountant to do that! –  Ozz Jan 26 '11 at 22:32
add comment

I think it's ridiculous that you should be able to write perfect, syntax correct code on demand (see @justtk's answer). I don't know what it's supposed to test because it's not testing how actual programming work. It's got to be something else they are looking for.

Problem with this approach is that you might very well end up with a narrow guy who knows all the functions in the api, but miss a truly great programmer who finds solutions to real problems, but may have to look up a few constructs.

I'd much rather they give you a realistic problem to solve on your own and then present it to the reviewer with working code.

So no, writing code as prose seems extremely unimportant to me.

share|improve this answer
add comment

Your Answer


