Today's Question:  What weekend projects have you created?        GIVE A SHOUT

Technical Article => Business =>  Google

C++ and Java over Python in Google products

  sonic0002      2014-07-20 04:39:09      13,979    2

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 Python. They use C++, Go, and Java for production software systems, with Python employed for scripting, testing, and tooling.

There are a bunch of reasons for the primacy of C++ and Java:

  • 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 "In the war of Perl versus Python, I come down on the side of Python. But I would never use it to build a production, scalable, mission critical, performant system—particularly one someone else may need to understand some day long in the future."

Also Python and Java had some different design goals.

Python is a language that is optimized for readability and rapid development. It's very well suited to the more entrepreneurial groups that are looking for product/market fit because iteration is quicker with a less verbose, less restrictive languages.

Usually we use Python for most of the product both front end and back end but C++ and/or Java where there is a performance bottleneck. This lets us benefit from the speed of development with Python and speed of execution of code with Java. Google seems to use them in similar capacities.

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.



Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious



laaan [Reply]@ 2014-07-22 09:33:18

My first language and maybe the only one I can be productive with is C++.

So it's hard for me to see any interest by using anything else.

But the most important today is speed, you can't say that it doesn't mind, you can't.

You should not using python, php or perl anymore, even for scripting.

Python doesn't suit the modern programming that we need now.

And go syntax and api is pretty well, maybe more beautiful than the python one and the most important it's pretty fast.

NightCat [Reply]@ 2014-07-22 09:58:04

We first need to make it clear here what the speed means. Does it mean the speed to make the program work or the program execution speed on the machine.

If we are talking about the program execution speed, we may choose the lower level languages like C++, but if we want to develop something within short period of time, then we may consider to use Python, or Go as you said.

Is Go fast enough compared to Python when developing something?

Oh, forget one thing, is Go easier to pick up than Python?


Don't call me Peter again

By sonic0002