I have quite a strong opinion here, I believe that if you are interviewing a programmer, you MUST ask him to do some code, would you hire a pianist without asking him to play the piano before? These are the three things I believe you must ask him:
What follows is extracted from an article I wrote on my blog 3 tips to know how good is the candidate you are interviewing
1.- Make the candidate draw a high level design.
This activity will help you to know how good designer the candidate is.
Ask the candidate to explain in a board the architecture and design of some previous application he has developed. This will allow you to engage him in an open conversation, by the end of it you should be able to answer yourself the following questions:
How good was he explaining the design? One of the most important qualities of a programmer is his communication skills, is almost as important as the quality of the design, if the candidate is not able to explain it in a clear, concise and focused manner, then how is the rest of the team going to understand it? How good was the design? How good was he answering your questions? You want to make sure that the design he is explaining is his design, so ask him a few questions and see how he answers you, based on that you should be able to tell if he is really the author of the design.
2.- Make the candidate write some code.
This activity will help you to know if the candidate is able to produce working code in a realistic time frame.
There is a very popular article from Joel Spolsky “12 steps to become a better code” where he states as point 11 “Do new candidates write code during their interview? “, well, I couldn’t agree more, that will give you an unique perspective on how the candidate really performs, there are still a few considerations.
Leave him alone in a room with a computer, just come back when the time is over.
Make him code using the same tools he would use in the position he is applying for.
Leave him enough time to complete the task
3.- Make the candidate review some working code.
This activity will help you to see if the candidate has a good sense of what good code is and will help you to determine how good he is reading code.
By asking the candidate to write some code, you should have some idea on how clean his code is, but that could be a false impression as you will be judging based on a piece of code which has been written under quite pressure, that’s where this other activity will help you, hand him over some poor functional code written in the language he is applying for, and leave him alone with it for as much time as you think he will need to review it, then come back and ask him the following questions.
What is the purpose of the code?
What do you think of the code, is it a clean code?
What would you change from the code to convert it into clean code?