Java vs Python for Google/Facebook/Apple
Oct 10, 2021
30 Comments
I’ll interview at these places in 1 year or so and I’d like to choose a language to really master: this would mean choosing it for LC, studying it more in depth and trying to get projects/tasks at my current job where I could practice it.
I’m currently decent at both, but expert in none.
I’d pick Java because it’s arguably better for scalable backends but maybe nowadays with all the ML projects Python might be a solid choice too?
In case company preference matters, here’s my preference order: G>F>A
Motivating comments are appreciated :)
comments
Also the language you interview with (and are better at) might influence in which team you end up or the ramp up time once you join
I've been writing Java in prod code and wouldn't want to touch python with a 10 foot pole. It's hard to reason about across files and methods. I have been part of multiple python to go/Java migrations and it's not fun. Unfortunately because of the over reliance on ide, I can't write Java from my memory and make syntactic mistakes if not for that. Python is easy to write without an ide, and in fact, ide support is much poorer for python because of lack of typing etc
Each language has it's purpose. Mixing them up doesn't help.
I don't think there's a prestige level of knowing specific languages at Google, and a lot of that is due to most Google SWEs being polyglots. Because at the end of the day 95% of everything at Google boils down to throwing data into a protobuf and making a RPC call regardless of the language.
Career progression is based far more on design ability and ability to launch a product rather than knowing any specific language or technology.
Basic requirements for languages to use in interviews
1. Broad support for object literals.
In python you can write
char in ['\n', ' '] instead of char == '\n' or char == ' '
in python you can access the last n elements in an array or string using
arr[-n::]
want to create a trie?
```
def create_trie(words):
trie = {}
for word in words:
current = trie
for ch in word:
current.setdefault(ch, {})
current = current[ch]
current['$'] = word
```
show me how you can do that in fewer lines of code in java
2. Standard library that includes all basic data structures, set, heap, dictionary, list, deque.
That said I agree with others, use the language best for the job viz python