Do Interviewers Frown at Potential Hires When They Use Ruby or Python to Solve an Interview Question?
Posted Thursday, Aug. 16, 2012, at 9:10 AM
This question originally appeared on Quora.
Answer by Edmond Lau, engineer at Quora:
Having interviewed a few hundred candidates across Google, Ooyala, and Quora, I would contend that the situation is quite the opposite, particularly if you're interviewing at the faster-moving end of companies like the typical startup. The choice of programming language matters, and most candidates I've interviewed who can code only in C, C++, or Java put themselves at a competitive disadvantage relative to those who use Ruby or Python.
In an engineering interview, you typically only have 30 minutes to an hour to impress your interviewer and to demonstrate that you can solve technical problems and get things done quickly. The faster you can complete a problem correctly, the more quickly I, as an interviewer, can move onto harder problems or assess your other skills.
Your choice of programming language is therefore important to the extent that it affects the speed with which you can solve problems. Languages like C, C++, or Java tend to be significantly more verbose than more productive languages like Python or Ruby that come with more powerful built-in primitives like list comprehensions, functional arguments, destructuring assignment, etc.
Research by Prechelt that compared 80 implementations of the same set of requirements across seven different languages showed that solutions written in C, C++, and Java were on average two to three times longer in terms of non-comment lines of code than scripting languages like Python. Paul Graham has also written extensively that one of the competitive advantages of his Viaweb startup was a more powerful and productive programming language.
The research lines up with my personal interview experiences, and I'd estimate that it takes the typical candidate roughly three times longer to express the same algorithm on the board in a non-scripting language than it does in a scripting language. In interviews where a candidate actually needs to write executable code on a computer, the time that a person spends compiling C, C++, or Java code is time that another candidate who's proficient at Python or Ruby is using to address the actual problem itself. Once you factor in the additional time needed to recover from mistakes or bugs, the absolute time differences start to compound. Each minute spent writing boilerplate code or additional syntax for a less productive language is a minute not spent tackling the meatier aspects of a problem.
The ability to choose the right tool for the job is an important skill. Choosing a less productive language makes me wonder as an interviewer whether you'd choose less productive tools on the job, like trying to write C++ or Java code to parse and format files when someone can be orders of magnitude faster using shell scripts or a scripting language.
There are two exceptions I would make for candidates that use C, C++, or Java on a problem that could be more quickly solved with a language like Ruby or Python:
- If you're a fresh college grad who hasn't picked up a scripting language, I tend to be more lenient and evaluate whether I think you can pick one up quickly on the job.
- If you're more experienced, really proficient at C, C++, or Java, and can solve a problem as quickly as a good programmer who uses Python or Ruby, then that's a strong a skill to have, and I'll take into account that it'd probably be easy for you to pick up a scripting language. Still, there would be a lingering doubt in my mind wondering why you didn't learn a more productive language over the years, since you would've been able to solve the problem that much more quickly.
All that said, there are probably certain interview situations where using a non-scripting language might be desirable. If you're interviewing for a search company or a company that focuses on iOS or Android development, using C++, Objective-C, Java, or whatever the core language is at the company would certainly help demonstrate that you could be effective on the job quickly. If you don't know a scripting language well, it's better to use a language you're proficient at, though it'd be even better to just get proficient at a scripting language. Ultimately, you want to pick the programming language that most effectively demonstrates that you'd be productive. My advice would be to ask your interviewer if he or she has a preference, and if not, to choose the most productive programming language for the problem.
More questions on job interviews: