Should Interviewers ask Puzzles to Software Developers in an Interview to evaluate their skills?
Programming is not about writing lines of code, it is about solving problems for the people. Some interviewers ask puzzles in an attempt to gauge software developer's ability and approach to solving problems. Puzzles can be useful in assessing problem solving skills, which is of course one of the key aspects of programming. Interviewer's expectations in that case are to hear you articulate your approach to the problem. What other data would you try to gather? How would you test your hypothesizes, etc. The point of asking the puzzles is to watch how developers work toward the solution, not necessarily if they get the right answer. You can spot good programmers pretty quickly just by watching this process. The interviewer must have been referring to problem solving and logic skills, which is part of the everyday work of a programmer. When given a problem, you need to be able to analyze it, subdivide it, and write a solution for it by using the most optimal approach.
Personally, I don't think that such puzzles provide an accurate indicator. I cannot understand the connection between such puzzles and programming. In the "real world", you have more than five minutes to figure out if your dealing with a bin packing vs a back pack problem, for instance. Initially, it's sometimes easy to misunderstand the problem at hand until you're in the middle of applying the wrong solution. That happens to people with 1, 5, 10 or even 20 years of experience.
The best interview 'puzzles' are the ones where you sit down at a computer to solve a problem in the domain in which you claim expertise. I also dislike the "Well, a programmer should be able to ..." thinking because it doesn't take into consideration that people get anxious when hit with something unexpected in a setting that is already stressful. Sure, you could solve that if you had time to think about it.. and perhaps you could solve it faster if you realized that your life would be over if you didn't. Do you want to work somewhere where your life will be over if you can't solve problems in five minutes? Will you get fired if you can't?
Should all great programmers also be champion sudoku solvers? I'm sure that plenty are, but it's not like some kind of prerequisite for competency.
I'm not saying that you should not be tested on how you approach problems, but the tests should be fun and invite the 'best' that the applicant has to give, given their area of expertise. Proving that you are as smart as a character that Bruce Willis portrays seems kind of pointless, considering that producers spent a pretty sum to get that scene just right.
These sorts of puzzles are generally used by interviewers who neither know what they are doing nor how to look for developers? These are just voodoo hiring practices. Some interviewers ask these questions so they feel like they are supposed to. They know that not answering the question is "bad" and answering is "good", but they can't tell you why beyond non-answers like "a developer needs these skills". They are a waste of time and an indicator that the interviewer is not a competent interviewer. In other words, if you detect that you're being interviewed by someone who has little comprehension over what you'll actually be doing, excuse yourself to go to the restroom and never return.
Suggestion to Interviewers
It is far better to ask coding questions to the software developers. In other words, you need to ask questions that allow you to explore the skills and behaviour of the software developer as they try and tackle the problem. Asking silly puzzles instead of coding philosophies will not give you any indication about how good that person is for the job.
Always try to make the applicant feel as comfortable as possible, so that you can actually try to find out how good that person will be for the job. The best programmers are those who understand the dynamics of software development, even if they don't have the highest IQs.