Why Java Was Picked for Android
As programmers we have a bewildering amount of platforms and languages to choose from. Making such a choice is not always easy, yet it’s quite and important one. So, There are many reasons behind, Java Picked Android.
Why did Google choose Java anyway?
Well, there weren’t that many popular choices that were also in good standing with developers. In Additionally, Google had quite a lot of developers that were using Java because they need it for their own infrastructure.
Since, It was also open source, they decided to fork the Java Virtual Machine, and create the Dalvik VM. This is not exactly unheard of in the world of open source software, and in fact, it’s not even the first time this happened to Oracle since they bought Sun.
Sun to Open-Source Java Under GPL
First, Sun Mircrosystems couldn’t do it. Then Sun teased us with it and had open-sourced Java under the GPLv2 in November 2006.
Sun released the first pieces of source code for Sun’s Implementation of JSE (Java Platform Standard Edition) and a buildable implementation of JME (Java Platform Micro Edition). Later, Sun had also released the JEE (Java Platform Enterprise Edition) available under the GNU GPL v2 (General Public License version two).
Sun is also trying to bring new open-source developers by encouraging them to join use Sun’s Developer Services program and join the Sun Developer Network Program, at no cost. Later, Sun Mircrosystems is acquired by Oracle Corporation on January 27, 2010.
Few Reasons For Google Using Java
Google hits a bullseye with smartphone users when it brought out the first version Android operating system. At that time when Nokia and its proprietary Symbian operating system, ruled the roost in smartphone market.
Google brought out the first version of Android in 2007. Today, Android smartphones rule the world with over 85 percent of the smartphones in the world running on various version of Android OS.
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.
Why not Python ?
For more task, 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 isloation 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.
Why Java ?
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. See here Why Android Choose DVM
Android’s source code is released by Google under open source licenses, although most Android devices ultimately ship with a combination of open source and proprietary software required for accessing Google services.
Android is based on the Linux Kernal and designed primarily for touchscreen mobile devices such as smartphones and tablets. Android’s user interface is mainly based on direct manipulation, using touch gestures that loosely correspond to real-world actions, such as swiping, tapping and pinching, to manipulate on-screen objects, along with a virtual keyboard for text input.
The Android Apps and games, which are so popular among smartphone users are compiled by developers using the Android Software Development Kit (SDK). The Android SDK is compiled using Java programming language.
Advantages Having Java Over Other Programming Languages
The basic advantage of having Java programming language for Android SDK’s is given below :
- Java is a known language, developers know it and don’t have to learn it. Java has yet again emerged as the world’s most popular programming language. Also there are lots of engineers who specialise in Java making it easier for them to compile Apps and Games.
- Since Java is the most popular programming language, a large number of development tools are available for developers. Java has huge open source support, with many libraries and tools are available to make developers life easier.
- Several mobile phones already used Java ME, so Java was known in the mobile industry and the engineers.
- It’s harder to shoot yourself with Java than with C/C++ code since it has no pointer arithmetic.
- It runs in a VM, so no need to recompile it for every phone out there and Java is easy to secure. This is Java’s very important feature. Running on a VM (thus no recompiling) is a huge plus.
- Also, It easily separated processes from each other, preventing a rogue application from destroying your phone or interfering with other applications. Every App has assigned its own address. All addresses are translated by MMU. This provides base level security to the App and the Android ecosystem by preventing leakages.
- The speed difference is not an issue for most applications; if it was you should code in low-level language.
- Also, Android as a operating system runs on many different hardware platforms including smart TVs, Android wear etc.
- Given that almost all VMs JIT compile down to native code, raw code speed is often comparable with native speed. A lot of delays attributed to higher-level languages are less to do with the VM overhead than other factors.
- Java allows developers to create sandbox applications, and create a better security model so that one bad App can’t take down your entire OS.
Why Go Was Created ?
Moving forward, Google is already considering alternatives for Java, such as their own language Go v1.0, which they just finished recently. From what developers are saying, it’s one of the best languages out there right now. Here’s why Go was created.
Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language. It also aims to be modern, with support for networked and multicore computing. Finally, it is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.”
Go does sound impressive, but unfortunately that’s not the biggest issue with moving Android to Go, or any other language. Doing this will disrupt a lot of thing not only for Google but also for the entire Android ecosystem.
What If Java is Deprecated ?
Android developers will now have to learn Go, If java is deprecated. Google will need to find a way to make Go, a cross-platform language like the Dalvik VM, so it works for other chip architectures. Finally, they will have to do some major rewriting for Android to support Go as well.
In the long run it definitely sounds like something that would be ideal for Google since they’d have full control over what happens with the languages. Since it’s such a friendly language they might even get developers to be interested in learning it, just like the vast majority of iOS developers had to learn Objective-C to make iOS apps.
But in the short term this transition would definitely be painful for Google and everyone else. So right now they might be considering it, and even doing experiments with it, but I doubt we’ll see anything come out of it in the next few years. Of course, this all remains to be seen pending a win in the lawsuit with Oracle.