Do you ask for a code sample when interviewing someone?
Don’t. It’s a terrible idea. It creates stress and doesn’t give you any useful answers.
Seeing code they’ve written is obviously good and useful, but the way to do this is not to ask for a sample, it’s to set them a small task (something that shouldn’t take more than an hour or two) and ask them to code a solution to it.
Sure, for some people it will take more time, but for most this will be less stressful and for you it will be infinitely more useful.
Why it is less stressful:
- It puts everyone on an equal footing. Some people can’t give you a recent coding sample because everything they’ve written recently is under NDA.
- They are not trying to guess what you’re looking for because you’ve said what you are looking for. They don’t need to guess whether you’d prefer something cute and clever or boring but well tested. They don’t need to spend ages sorting through a bunch of code they’ve written trying to figure out what will best fit your subjective requirements.
Why it is better for you:
- Less stressed candidates produce more representative answers.
- You have more control over what you are testing for, and can refine this over time.
- Any question where you can’t compare the answer between candidates is a waste of your time and theirs because it’s so subjective and poorly calibrated that you might as well just toss a coin. You can compare coding tests, you can’t compare coding samples.
Code samples: Bad for the candidate, and worse for you. Just say no.