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++

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.

Java

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.

Also, note that you can use Google's Web Toolkit to compile Java code into JavaScript. So that awesome webpage or widget you see might have began life as a Java class.

Python

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...)

JavaScript

Obviously Google uses a lot of JavaScript. However, the type of JavaScript written at Google is different than what you see in the wild. Google has developed an optimizing JavaScript compiler that allows you to construct annotations in comments in exchange for better optimizations and static checking. See Google Closure.

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.

Open-Source

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.

