Monday, May 04, 2009

The most important job interview question to ask an R&D candidate

I've been thinking about what one question I would ask a job candidate (for an R&D job) if I could ask only one question. This assumes I've already asked my favorite high-level question, which I discussed in yesterday's post.

Most good "R&D job" questions, of course, are open-ended and have no single "right" answer. They're intended as a starting point for further discussion, and a gateway to discovering the reasoning process of the candidate.

One of the better such questions I've heard during an interview came when I applied for a job at a well-known search company. One of the five people who interviewed me asked: "Explain how you would develop a frequency-sorted list of the ten thousand most-used words in the English language." This was an outstanding question on many levels and led to a very lively hour-long discussion. But I'll save that for another day.

To me, if I'm interviewing someone who is going to be involved in writing code, and I can only ask one question in the course of an interview, it would be: "Explain what 'bad code' means to you."

If the person starts going down the road of "See what kind of warnings the compiler gives you," "run it through lint," etc., I would steer the person back on track with: "Aside from that, what would you do if I gave you, say, a couple thousand lines of someone else's code to look at? How would you judge it? What sorts of things would make the code 'good' or 'bad' in your eyes? Assume that the code compiles and actually works."

If the talk turns immediately to formatting issues, that's not good.

Presence or absence of comments: Starts to be relevant.

Coding conventions (around the naming of variables and such): Yeah yeah yeah. That's good. What else?

What about the factoring of methods? Is the code overfactored? Underfactored? Factored along the wrong lines? How can you tell? (This leads also to the question of how long is too long, for a class or method?)

What about evidence of design patterns? Does it look like the person who wrote the code doesn't know about things like Observer, Visitor, and Decorator patterns?

Does the code follow any antipatterns? Is it just plain hard to follow because of methods trying to "do too much," overusage of custom exceptions, overuse of cryptic parent-class methods, constructors or method declarations with 15 million formal parameters, etc.?

What about performance? Does it look like the code might be slow? (Why?) Could the author have perhaps designated more things "final"?

Is code repeated anywhere?

Is the code likely to create garbage-collection concerns? Memory leakage? Concurrency issues?

This list goes on and on. You get the idea.

Special extra-credit points go to the candidate who eventually asks larger questions, like Was this code written to any particular API? Is it meant to be reusable? (Is it part of a library versus plain old application code? How will people be using this code?) Is it meant to have a long lifetime, or will this code be revisited a lot (or possibly extended a lot)?

I'm sure you probably have favorite R&D questions of your own (perhaps ones you've been asked in interviews). If so, please leave a comment; I'd like to see what you've got.

17 comments:

  1. Anonymous6:49 AM

    Obsession with job interviews is not healthy!

    ReplyDelete
  2. I always liked "Can you draw me the architecture of your most complex project?"

    ReplyDelete
  3. Anonymous7:11 AM

    if you can tell he knows design patterns from the code, it is probably bad code

    ReplyDelete
  4. Anonymous8:58 AM

    Assume you're woken up at 3 in the morning (bouns:with a hangover) and you are asked to debug a piece of code
    AND you only know that the code does but have never seen it before.

    Shittiness of the code is directly proportional to how long you take to hunt down the bug.

    ReplyDelete
  5. Anonymous10:51 AM

    I agree witht he Anon above. Obessing over what questions to ask and how they answer them is great if your hiring a MBA for a useless management position; however, IMO when it comes to R&D you dont want anyone who has instant solutions or answers but someone dedicated and interested enough to spend hours digging through research papers and thinking up of new ideas.

    ReplyDelete
  6. Anonymous11:12 AM

    "What about evidence of design patterns?"

    stopped reading right here

    ReplyDelete
  7. Anonymous11:27 AM

    BINGO !!!

    ReplyDelete
  8. Anonymous11:49 AM

    Even if you agree upon a definition of "bad code", it still can mean different things for different people.

    How about if a part of de "bad code" definition is "requires the reader to be able to handle mor information at the same time than the reader can handle". If the programmer can handle 10 things simultaneously and the code requires you to be able to handle 8 things simultaneously, then it's good code for the writer. But if someone else is to read/maintain the code, and that somebody only can handle 7 things at a time, then it's bad code for that person. If you reverse things, code might have been bad for the writer but may look acceptable to the reader if the reader can handle more things simoultaneously than the writer could...

    ReplyDelete
  9. Anonymous11:59 AM

    Job interviews that are set to prove the interviewer intelligence = waste of time.

    To humor:

    Good Code: Delivered on time, provides functionality and efficiency.

    Great Code: Is documented, can be maintained and expended upon is necessary.

    ReplyDelete
  10. Anonymous12:40 PM

    Asking the candidate to come up with a list with no prompting is not going to get you very far.

    Better to give the candidate some code and get him to critique it.

    ReplyDelete
  11. I tend to agree with a majority of commenters here. Interviews are just a fence to sift out people you did not appear to like. (Sorry for the mixing of metaphors.)

    ReplyDelete
  12. Anonymous4:56 PM

    I'll disagree with Simon. I like this question, and it's not a typical "how would you weight Mount Everest?" type of GOOG/MSFT interview question.

    The answer you get is completely and directly proportional to the amount of coding experience the responder has. If they're green, you'll get formatting and compiler warning questions. If you've had 15+ years of slogging through other people's crap, you'll come up with a completely different answer.

    But I have to agree with the anti-design pattern people. That's an immediate bong in my book. If I ever walk into another shop and see ONE copy of that book on someone's desk, it's over.

    ReplyDelete
  13. Anonymous7:38 AM

    Those who can, do. Those who can't, try to solve every problem with design patterns.

    ReplyDelete
  14. Anonymous8:19 AM

    Another topic is about the wish to develop or not. Lot of developpers do it to work not by wish. The question should be: "Did you develop personal projects? If yes, can you describe me them?"

    ReplyDelete
  15. Hi,

    It is good to see so many people taking initiative and giving us a good info on Job Interview. Thanks a lot for sharing it.

    Job interviews could be tremendously demanding more than ever when it is a job that you have always wanted. On the other hand, if you chase the job interview instructions you would cross the threshold to your then job interview with a great deal of self-assurance.

    You should be able to make every possible effort to prove yourself worthiest for the job. Your every effort should have a positive approach and you should be able to throw light on your positives, your talents and your work experiences. Spaced out from this, you should be able to drive the attention of the interviewer from your negatives such as time-lag in your academics and career, or long-drawn-out hunt to obtain a job could have a negative effect on the job interview. Prepare yourself best for the job interview and get your desired job.

    ReplyDelete
  16. Thanks once again putting in the context its opportunity gain through an user if you find a jobs in india to post your CV you got a dream job.
    search jobs in chennai

    ReplyDelete

Please add your comment here!