Why did Google choose Java for the Android Operating System? [closed]
This post was edited and submitted for review 5 months ago and failed to reopen the post:
Opinion-based Update the question so it can be answered with facts and citations by editing this post.
Why did Google choose Java for the Android Operating System and not some other language?
I have revisited this question 9 year开发者_JAVA技巧s later. I realize that this question invites a lot of debate and personal opinion. I want to try to and reframe this question if possible, so we keep personal opinions and preference out of it.
Why Java specifically? Was it because of technical merits? Was it because so many developers know Java? Was it because Java was actually the best garbage-collected language at the time? Or was it because that is what the initial developers chose and they had to stick with it once the project got officially picked up?
I know that there are more modern languages available today then there were in 2008, when Android was first released. I don't know though how many viable alternatives to Java Google had in 2008. And I don't know much about the Java ecosystem, as I'm not a Java developer. Was Java the best available open source alternative back then? Was it a good option because Sun was still developing it back then?
These are the kind of considerations I wanted to know about. Environmental constraints, technical constraints, etc. And I don't mean which language is better. I mean which language could have fit their needs better and why in the end they chose Java?
According to Google:
We've been over a bunch of [alternatives to Java], and think they all suck. We conclude that we need to negotiate a license for Java under the terms we need. Source
It's not a particularly descriptive why, but it's about as good as you'll get from Google, I'd imagine.
Google, as a company, uses Java a lot. The search features are written in Java. As far as I can tell from the outside, Google likes Java.
For most tasks, Java is faster than Python. I would rather work in Python, and I know how to write reasonably efficient Python, and yes PyPy is really shaking things up, but Google needed to provide a snappy experience on relatively underpowered phone processors so they likely didn't consider Python a contender.
Java, like Python, provides a great deal of isolation from details of the underlying hardware. I think all Android phones are ARM-based, but in theory you could make an Android phone based on an x86 chip or something completely different, and as long as you do a good job of porting the Dalvik VM, your code will run. (Aside from apps that have native ARM code compiled in, of course.)
Google likes the Java language, but they chose to write their own VM ("Dalvik") rather than license the Java VM. Compiled Java can be directly translated into Dalvik bytecodes. (Oracle sued Google over this. Oracle lost the lawsuit.)
精彩评论