I have heard Google uses Python, Java and C++. But what I don't know is how is each of those programming language is used. I mean what is Python, Java and C++ is used for at Google. Why would they used upto 3 programming languages when 1 language is enough. Does anybody know?
The correct answer "because different languages have different strengths " has already been stated. But let me provide some more detail on why:
C++ has the main advantage of being the fastest of the lot. Not necessary because Java and Python are slow, but because in C++ you have more control about how things get executed.
For example, if you are writing a web services frontend that requires less than 30ms latency you can tune C++ code to achieve that performance. In a managed language like Java it is a bit harder to get the GC to cooperate perfectly.
C++ is used for a lot of 'Google magic' such as BigTable, MapReduce, and search goo.
For most standard applications, Java is a perfectly fine language. It features great tools, lots of existing libraries, and not a lot of time spent debugging.
Java is used for a lot of bigger websites that would be much more difficult to maintain in a lower-level language like C or C++. For example, my understanding is that GMail is written in Java.
Python is a fantastic general purpose language, but doesn't offer as much fine-grained control as even Java. (For example, there are all sorts of crazy JVM arguments for things -- does python offer similar configuration?)
However, with Python is perfectly suited for simple websites and applications that would otherwise be horrible shell scripts. For example, if you wanted to write a simple testcase to gather data from some sources, process them, and upload them to App Engine Python would be a good choice. (If you needed to distribute that processing across 1,000 machines however, perhaps you could use a different language...)
Language Doesn't Matter (interop)
Another reason why Google doesn't use just one language is that it doesn't need to. There are facilities in almost every modern programming language to call into external libraries, libraries which may be written in a different language. (See swig.)
Also, since App Engine runs the JVM you can run any language that compiles to Java byte code. (At Google we primarily stick to the languages mentioned here, but this isn't a hard requirement.) If you want to use Closure, Groovy, or Scala on App Engine if you include the right JAR files everything should just work.
Also, Google uses and contributes to a lot of Open-Source where possible. These projects usually are written in one of the above languages and requires it to be 'used' at Google.
The bottom line is two things:
- Every programming language has its own strengths. To not take situationally take advantage of these strengths would be a shame.
- The available of interop toolkits and compatibile runtimes means that it is less painful to use multiple languages within the same runtime environment.
1 language is enough
Maybe one language is enough to complete a number of different tasks adequately, but different languages have different strengths, weaknesses and abilities.
Since google most probably program for a large number of different situations it's a case of horses for courses, the best tool for the job.
These three languages are used for different purposes.
Python might be used for writing automation scripts.
C++ for implementing complex algorithms.(Indexer, Crawler, Map-Reduce, Big Table)
Java for web services, web apps, etc.
These are my assumptions only.
Python is used for their support website,you can see that This page is generated by a python script,they use java libraries for web applications,hence the GWT and java support in the app engine
I think they use C++ for google earth,or for desktop applications in general
"1 language is enough" can only be true if every project you do is of a specific kind. And for some projects, even C++ Java and Python are not the best tools. Furthermore, knowing only one language is a distinguishing feature of the poor programmer.
They write native Mac and iPhone applications too, and those are in Objective-C. The reason they do that is simple: the APIs are in Objective-C.