C++ and Java over Python in Google products
In Google, most of the products are written in C++ and Java. They usually don't choose Python to write their product stack. What's behind the decision to choose one language over the other in Google? Let's get to read some opinions from Robert Love, a Google software engineer.
Love said he couldn't imagine writing let alone maintaining a large software stack in
There are a bunch of reasons for the primacy of C++ and Java:
. They use , , and for production software systems, with Python employed for scripting, testing, and tooling.
- Familiarity. Early Googlers were well-versed in C++.
- Performance. Java can be faster than Python; C++ can be faster than Java.
- Tooling. Tools for debugging, profiling, and so on are significantly better for Java than Python. Even C++ is easier to debug and understand in large systems.
- Concurrency. As you can imagine, Google systems are highly parallelized and many are highly threaded. Threading in Python is an unmitigated disaster. The global interpreter lock (GIL) is a giant pain in the ass.
- Lack of need for the prototyping prowess of Python. One commonly-cited strength of Python is that it is easier to rapidly prototype small systems in Python than Java and (to an even greater extent) C++. At Google, however, this benefit isn't all that appealing: We have a lot of powerful frameworks that make prototyping or extending existing systems easy. Folks tend to prototype by gluing a hack into an existing server rather than build an entirely new distributed system.
Finally, he said "
So the final suggestion is the language to be used depends on the requirement of the product, sometimes even in the same product we may use different languages.
It's a sarcastic picture describing how heavy the haze is in Beijing on Christmas day. Every winter people in Beijing will suffer the heavy haze.