Lately, I've been doing a fair amount of interviewing (as an interviewer, not a candidate) and have a few thoughts on passing my interview. Yes, that's right, I'm going to give you some advice that just might get you hired by my company.* Here's the best piece of advice I can give you. When asked a question, compose yourself and think clearly about the question before answering. The number one reason I ding people in interviews is because I perceive them to be muddled thinkers.
Muddled thinkers confuse customers when they give unclear answers to tech support questions. Muddled thinkers write muddled code, with comments that are equally incomprehensible. And muddled thinkers have a hard time learning new things, because they don't have a structure or system for applying that new knowledge. This leads to something my friend Duncan calls "programming by accident". Keep randomly permuting the code until it seems to work and then stop. This approach creates bugs and unmaintainable code. If it's your strategy for solving problems, I don't want you on my team.
A specific muddled thinking antipattern we see a lot involves the naming of temporary variables. If I ask you to write code and you need a temporary variable to solve the problem, stop and think clearly about the purpose of that variable. If you name the variable t in an attempt to finish as quickly as possible, you are well on the way to failing your interview. I won't fail you just because you chose a poor variable name, but I will fail you because your failure to choose a good variable name confused you to the point that your solution was incomplete, didn't solve the problem, or you begin randomly permuting your code in hopes that "if I just change this to that, it should work." That smells too much like programming by accident.
Think you have what it takes? Want to work at a growing (yup, even in these economic circumstances) startup? Want to work on a product that makes a difference in other programmers' lives? Smart Bear is hiring software developers and senior QA engineers. Send us a resumé. email@example.com.
* Remember when you're in an interview, the interviewer wants you to succeed just as much as you do. We don't do interviews for fun; we do interviews so we can get more people to help with our real work. Ironically, the backlog of real work gets longer the more interviews we do.