According to growing reports, Google could be considering making Swift, Apple’s object-oriented programming language forward as a “first-class” (first choice) language for the Android platform. Such move wouldn’t be an attempt to completely replace Android’s current “first class” programming language of Java, or at least short term, but the option could come to it.
The Next Web, who broke the reports, notes;
Google’s Android operating system currently supports Java as its first-class language, and sources say Swift is not meant to replace Java, at least initially. While the ongoing litigation with Oracle is likely cause for concern, sources say Google considers Swift to have a broader “upside” than Java.
Also noted in the post, something which goes without saying, work to transition to a world accepting Swift, which itself is open source, the entire Android platform would need to be re-engineered to support Swift as a language, but also as a runtime, which considering Android has already gone through a runtime swift to ART, from Dalvik, one from that to Swift would be a much more complex one, though naturally with Swift it would only be through in-app environments.
That’s not to say Swift is the only programming language being considered by Google for the future of Android, Google is also reportedly considering another language, Kotlin, as a first-class language. However, there are said to be concerns that Kotlin compiles too slowly, meaning Swift is currently the most viable choice, as ironic as it may seem.
Overview and possible drawbacks
When Apple announced Swift at their WWDC 2014 Conference, it was to replace Apple’s at the time first-class language, Objective-C, and Swift has definitely been well adopted by Developers all over, from major brands such as IBM, and is already included in many apps such as Lyft, Pixelmator, Vimeo and more which have all seen re-builds using Swift.
But, it’s not surprising to see why. Swift allows Developers to perform less code and effectively get the same results, but for Developers who are happy using Objective-C, or regular C code, they can continue to with Swift, meaning the progressional transition to using pure Swift code, is a much easier one for iOS development, and naturally that would remain an advantage, should Google consider Swift for Android, as Java code could not be used at all, though it remains to be seen whether Objective-C and C code could be used then for Android development.
Whilst, as we mentioned, it would take a great deal to be able to affectively use Swift as the full-on programming language for Android, using Swift on Android is not impossible, in fact it’s already being attempted. Late last year, a developer named Romain Goyet toyed with testing Swift code out for Android, and tests resulted with some mixed success. Whilst it wasn’t perfect at the time, it did show that it could be possible.
Those interested in more on how those tests went, should check out this page on what happened. Do keep in mind however, this is before Swift went open-source and does make you wonder whether it would be more successful today, though the same original limitations do remain so unlikely so. But, it does show it is possible. View Romain Goyet’s post here.
But, at the end of the day, such tests were in all sense of the words, baby steps, Google would still have to effectively recreate its efforts with Java, for Swift. But, if the company is motivated enough, it’s very possible to do so without compromising on its open source values or causing too much frustration with Developers along the way, as Developers sure ain’t complaining about Swift on iOS, though as we mentioned some advantages for iOS could still remain iOS advantages.
Reasons for this decision do remain questionable, although it’s rather interesting when questioned about this, Google felt it would be inappropriate to comment due to an ongoing litigation with Oracle (formerly Sun Microsystems), owners of Java, who have began lawsuits against Google for their vast fortunes (claims of $31BN) with Android using Java fundamentals. Even though the numbers make no logical sense, based on Google’s zero fortunes in Android directly, Oracle is requesting $1BN in damages. Think what you will as to whether this somehow links to Google considering “other” options.