views:

127

answers:

5

I just caught one of Google's commercials for Chrome where at the end they mention that it runs on Linux, Mac, and PC. So I started wondering how they are able to develop a program that can run on multiple platforms like that? I have experience with Java, and .Net but only on a windows machine. Java is by design portable, but I wouldn't think Google is using Java for something like Chrome where performance is such a concern.

I understand that each version is going to have some platform specific code, such as for the UI. But there must also be some central code that is reused across each platform. What language is this written in?

+2  A: 

Chrome is written in C++, so they will have a significant amount of platform-specific code for each OS. They most likely maintain a separate branch for each OS.

nasufara
Most likely they're all in the same branch, just with different compile flags for each platform. Or at least, that's the way it works on most C++ projects. Maintaining separate branches can be a huge pain.
Jasper Bekkers
+1  A: 

Here is an entire article about the development of Chrome. It's mostly written in C++.

Pace
A: 

The programs are supposed to be portable in source level, not binary level. So you only need to compile it for different platforms, not necessary to make one universal binary. In fact, most languages are supported in all modern platforms including UNIX/Windows/Mac, so you can choose from almost all modern lanagues, which C/C++ is prefered by many people. BTW, C++ is the language of Chrome.

Scripting languages like Python/Perl are also good choices. One more thing, Java can be faster than you think - see Eclipse. Even without JNI Technology, Java is still good enough for most applications like JDownloader.

Francis
If you think Eclipse is speedy then you've got some mighty low expectations.
Azeem.Butt
It may be not as good as fully optimized native program, but it's far better and faster than traditional Java GUI like JBuilder or Beans.In fact, I think it's good enough for common usage.
Francis
A: 

Google had to build different distributions for each OS (ie compiled for each platform as Francis's answer explains) - in fact the Mac OS version only recently became available - the Windows version has been around much longer.

Google Apps are 'thin applications' - the grunt-work is done on their servers.

The Apps are portable in the sense that the front-end is put together using HTML, CSS and Javascript - which are standard (in theory at least) across all browsers.

Google put a lot of effort into building Chrome's Javascript engine to be performant - to ensure any client-side logic is run quickly.

monojohnny
A: 

Any reasonably standardized and popular language will do, because the goal is to compile it on all platforms, not create one binary that will work on Windows, MacOSX, Linux, and z/OS. C and C++ are popular choices, because they'll work readily with pretty much anything. Java is a good choice, because it runs on pretty much everything. For applications with low performance requirements, Perl and Python are good.

The important point is to separate out what is platform-dependent from what isn't, since (except in the case of Java or scripting languages) it will probably be necessary to rewrite platform-specific stuff for each platform, and not necessarily in the same language. MacOSX is best programmed in Objective-C, and that's true for no other popular platform.

David Thornley