I was flying out to San Francisco to interview at Google in Mountain View. About a week before, my recruiter emailed me and asked me what programming language I wanted to use during my interview.
Easy! Java.
His response was something like “….. do you know any other languages?” I spent summer of 2014 at an internship writing code in Python, so I told him I guess I could do that, to which he perked up a bit, but I was certainly less than thrilled about it since it had been a long time and I’d never used Python in an interview before.
I asked around to several friends to see if anyone had any advice on interviewing in Python and pretty much everyone said something along the lines of “why the hell have you been doing interviews in Java? I only do interviews in Python.”
Why the hell have you been doing coding interviews in Java? Click To TweetMaybe this post is really just a way of explaining to those people why I chose such an “archaic” language for my interviews, but I hope that, more than that, it will help you to decide what language is best for you. The fact of the matter is that there is no one right language for every person and every interview, but these questions should help you narrow down what language makes the most sense for your given situation.
I’ve structured this post as a series of 5 questions. My hope is that as you go through you will be able to eliminate languages until you narrow it down to a single one. To start with, ask yourself:
Are you interviewing for a language-specific job?
If you’re trying out for a rock band, you shouldn’t sing opera during your audition. Your ultimate purpose in an audition is to show that you would be a good member of the band. Even if you’re a great singer, unless the band has a need for someone to sing opera they don’t really have any idea whether you will sound good singing rock. In the same way, why would someone want to hire you as an Android developer if all they know about you is that you are good at Ruby?
If the job you’re applying to is language-specific, this makes choosing a language for your interview really easy. Interview in the language you’re going to be using for your job.
The best way to show off your value to the company is to show them that you are good at what you will be working on. Be sure to know the language intimately and be prepared for language-specific interview questions, since these are all fair game during your interview.
While it is important to use the right language if you’re interviewing for a language-specific job, many positions are more general, particularly for new grads. While these positions may use one primary language, there is little expectation that you will be very knowledgeable when you start and the plan is often for you to receive some training. If you’re applying for a job like this, your next question is:
What is your best language?
Interviews are stressful. There’s a lot to remember and you’re under a lot of pressure not to totally blank on things that you should know. The easiest way to ensure that you don’t remember proper syntax or that you make trivial errors is by picking a language that you don’t use a lot or are uncomfortable with.
As is a recurring theme by now on this blog, stack the deck in your favor while you’re doing an interview. You will do best by eliminating all possible stumbling blocks, and you can do this easily by choosing the language you are most comfortable in.
If you use multiple languages on a regular basis, then you’re in luck, but remember the context of these interviews. While you may use Javascript regularly, you probably don’t write lots of complicated algorithms. As a result, you might be better off writing in Python if you also feel comfortable with that.
If you’re still unsure what language to use, ask yourself:
How easy is it to solve algorithmic problems in the language?
Some languages are better for different things. You (probably) wouldn’t use C++ for your website, and you wouldn’t use Javascript for statistical analysis. In the same way, some languages are better for interviews.
Since different languages have different built in types and different paradigms, the language you choose can drastically change not only how you solve the problem, but what problems you get asked.
For example, popular problems in Java involve modifying linked lists. However, in Python lists are a built in datatype, so those problems don’t make a whole lot of sense. While you certainly could implement a list manually, why would you?
Ultimately, this is very much secondary to choosing your strongest language, but if you’re struggling to decide, choose the one that will make your life easier. Many people (including my friends) prefer Python for this reason.
However, it isn’t only about your ability to write code, but your interviewer’s ability to understand the code you write, so before committing to a language, ask:
Is the language easy to understand for people who don’t know it?
If I show you some code in Java, could you read it? How about Perl? How about LOLCODE?
The fact of the matter is that, while your interviewer might tell you that you can code in any language that you want, there are some languages that will be much easier for them to understand than others. And your goal is to be understood.
There are some languages that are very safe. Your interviewer should understand Java, C, and Python, so any of those languages are totally reasonable. Other languages, particularly more readable ones are fine too. For example, Javascript and Ruby.
As you move farther away from the realm of widely known languages, however, you should be more careful. Unless you know your interviewer has experience with Go or Perl or whatever other language, you may want to stick with one of the more popular languages.
It can help to decide how understandable a language will be to your interviewer by also asking the question:
Do they use that language at the company?
If you’ve gone through all the questions thus far and still haven’t managed to narrow down to one language, this is the last thing you can consider. While it is the least essential, it certainly doesn’t hurt to show that your experience would fit with the existing infrastructure at the company.
This is also an opportunity to show that you went above and beyond to research the company that you are interviewing for. You can show that you are particularly interested because you went to the additional effort, and while this likely won’t change their decision, it can earn you some brownie points.
At the end of the day, the language you choose for your interview primarily impacts two things: how easy it is for you to solve the problem and how easy it is for your interviewer to understand your solution. As a result, the language you choose is not going to make or break your interview, but it can certainly stack the deck in your favor, maximizing your own chances of success.
When I arrived at Google, I was pretty nervous, because, despite studying up on list comprehensions, I had never done an actual interview in Python. So I went in having no idea how it was going to go.
The crazy thing was, though: No one actually cared what language I used. Even though I had spent all this time studying Python, I went on to crank out all 5 interviews in Java. It’s funny how things turn out.
After all that, my Python skills didn’t matter, but I was prepared. By having two popular languages in my pocket, I was ready to tackle anything.
What language do you prefer to use in your interviews? I’m curious to know if this post changed what language you are going to use in future interviews. Let me know in the comments down below.