The other day I met a developer who went for a job interview and was asked to write a sorting algorithm. He was caught off-guard, didn’t do it very well, and failed the interview. But the company itself also failed, because it turns out they didn’t understand sorting algorithms either.
Here’s the test question: You run a company that creates software in high level languages. You have a collection of developers who want to work for you. How do you sort the ones who are most suitable from the ones who are least suitable?
The answer is to query each one in turn using questions that most closely match the actual work they’ll be doing.
If you need them to design domain models then give them a toy domain and ask them to model it. If they need to work particularly closely with other developers then get them coding next to one of your current team. And if, for some perverse reason, company policy bans the use of software libraries and they have to implement every basic software function from scratch every time, then it’s a good idea to ask them to write a sorting algorithm.
But if that last situation is not true of your company, then the correct answer to “Show me how to sort an array x of integers” is “x.sort()”. Or some variant according to your local tongue.
If you get that question wrong, then unfortunately you fail, and miss out on some really excellent hires.