(And why can’t Jeff Atwood use Unicode?
)
Via reddit comes some excellent insight into the failings of programmer job interviews. The “Fizz-Buzz example” had me intrigued enough to try and see how good I could get it working in two languages; in particular, Ruby and PHP. As MarkByers points out, there’s actually an online page where you can submit your implementation in a large number of languages, have it automatically compiled and tested against the spec, and see how you match up against others in efficiency.
Surprisingly enough, a sizeable number of comments fail to follow the spec properly. Several get the line breaks wrong, which perhaps would be forgivable, but a few even gloss over the “prints the numbers” part entirely. As far as I’m concerned, that’s what the test is really about: not about how fast, how elegantly, how efficiently or in how many languages you can write an implementation, but whether you’re actually capable of understanding the original problem specification, and solving the test accordingly.
Not unexpectedly, a number of posters find that obscuring their code somehow makes it better. This isn’t an unusual perception, but it is one I’ve never understood. Using language-specific capabilities is generally a good idea, of course, but if it takes you longer to think about (and therefore, ultimately, longer to write), it’s going to take others even longer to read. If you’re writing code only for yourself, that may be alright, but that’s hardly ever the case. Consider that, one day, you might not even be at the company any more to explain your code to others, or you might simply have forgotten.
I personally feel that a small performance penalty is actually acceptable if it means far more readable code, which is frequently the case. Performance can be improved with newer machines, whereas you are unlikely to find people who are more capable at reading code. I.e., the former scales; the latter does not. (Of course, there is such a thing as performance-critical code, but unless you’re specifically asked to write that, I don’t believe you should attempt to.)
Another reddit user, danweber points to “The Five Essential Phone-Screen Questions”, which is actually a decent enough way to double-check your own skills; if you can’t answer all those functions well enough, you should probably get some practice before you start looking for a job.
As many have mentioned, nervousness plays a role; while interviewing, you can’t expect the applicant to be full of excellent ideas in solving your problems: in most cases, there is a lot anxiety.
Regarding the assertion that “The majority of comp sci graduates can’t [answer the FizzBuzz test]“, though, I’d like to point out this: a lot of people study computer science in order to become programmers, and a lot of companies target people with a computer science degree as prospective programmers to hire. A CS professor, however, would actually disagree that CS is intended for this; the course is intended to be far more theoretical than this. Research about how to move programming forward, as opposed to learning how to learn any particular (and thoroughly-developed) programming languages and paradigms of today.
In other words, an interviewer shouldn’t be surprised when a fresh CS graduate has little actual programming experience – unless they have been hacking away in private for years (which, mind you, is frequently the case), they simply won’t. Certainly, a CS degree-holding applicant is far more likely to have a deep understanding of the intricate workings of programming; they are more likely to abstract programming to the point where languages differ mainly in their syntax, and they can therefore typically adjust to new languages, frameworks and paradigms far more easily. However, all of that is of little user to a manager in the here and now; they need someone to solve a concrete problem. I believe that interviewers would be far better served looking for applicants not by their degree, but by their ability to solve things such as “The Five Essential Phone-Screen Questions”. A degree is an excellent bonus, but hardly an accurate measure of the person’s expertise at software development.
In general, if you have the time, I would recommend you read through all the comments at Atwood’s entry, as well as the ones over at reddit.