In the past week there have been a tremendous number of discussions, tweets, posts, articles, etc. about some new and modern programming languages. There is no doubt that these sudden swirls have been motivated by Apple unveiling a brand new language called Swift at WWDC 2014. Being on vacation for the past two weeks, I have read quite a lot about the Swift programming language, its syntax, its features, its Objective-C interoperability, etc. But I have also seen some people claiming Android, from a developer point of view, is out of date compared to iOS? Why? Because it is based on Java.

To be honest, I agree with them. It has been a long time I have been claiming Google should ditch Java for another language. The thing is I think Google has been working on a replacement programming language just as long as Apple did - in secret - on Swift (i.e. 2010). So? What is this modern programming language? Some people think Go would be a great fit, I personally think Dart is more appropriate. I read and learned a lot about Dart during my vacation. From my point of view, for many reasons Dart is better for Android than Go: it is more mature, it is VM-based (just like Java), it better fits the Google ecosystem and it has an extremely easy learning curve while still remaining a simple language. It’s clearly time for Google to make Dart the future of Android and, in a global fashion, the future of the company itself.

Java already has a room at the retirement home

I love Java. I really do. But Java is getting old, old enough to retire. Even though Java 8 can be considered as one of the biggest evolutions in the programming language history, Java still carries many drawbacks, limitations and problems. Most of these issues have been there from day one and will continue to exist due to the backward-compatibility nature of the language. On the other side, Dart has been created from the ground up keeping a simple idea in mind: fix the common and recurrent development problems. Dart solves many issues in the programming flow and helps developers create insanely powerful and fluent APIs. Here is a short list of some basic but modern features of the language:

No primitive types. In Dart, everything is an Object . Even bool , the Java’s boolean equivalent, is an Object . A pure object-oriented programming language should be all about Object s. Java’s primitive types in Java are just an implementation detail.

Way less verbose syntax. Creating a public constant known at compile-time can be done using the const keyword. No more public static final . public and private keywords are not part of the language. The visibility of a variable/method/class is based on its naming: everything is public by default. If the entity name starts with an underscore, it is private.

Named and factory constructors. Java requires constructors to be named according to the class name, say Rectangle() . If you create a Rectangle(int left, int top, int right, int bottom) and a Rectangle(int left, int top, int width, int height) you end up with a compile-time error because Java uses parameters to distinguish constructors. One way to solve this problem is to create a static factory method. Dart fixes this problem by allowing you to create named (and optionally factory) constructors.

Modern parameters passing: Dart supports positional and named parameters. They can also be optional and have default values.

And more: mixins, implicit interface, isolates (simple concurrency model)

Software is made by developers not lawyers

Google and Oracle have been fighting about the use of Java on Android for a long time. The Google VS Oracle trial has probably been one of the most important trials in the recent history of computing. It looks like we are currently in a era of peace between these two mammoth companies … or maybe it is just cold war. No need to say it is way too dangerous for Google to continue to rely on programming languages managed by competitors. They clearly can’t afford to continue to be vulnerable to threats of lawsuits.

Control the language, make it evolve

In order to be able to move forward, Google has to completely control over the programming languages they are using. For instance, Java 8 has been a bit of an holy grail for a long time. We have heard a lot about it in the past. And a lot of features and enhancements have been postponed. Now, Java 8 is here with some modern features like closures. Chances are we won’t have them on Android for a long time…

By controlling the language they are using, Google can maintain and evolve the language seamlessly on all platforms (mobile, web, server) whenever necessary. Apple did and still does that perfectly with Objective-C and Swift. For instance, they introduced closures 3 years ago in Objective-C just by making the language evolve. More recently, ARC and litterals were introduced. Apple controls the language. They can make it evolve and they do so when appropriate. Google is in the same position with Dart as stated on the Dart website:

Dart is an open-source project with contributors from Google and elsewhere. The Dart website www.dartlang.org/…

In theory, this quote indicates everybody can participate to the language by accessing to the source code or submitting patches and enhancements. In practice, just like with the Android Open Source Project (AOSP), only Google controls Dart, because it is the only company that has enough resources to maintain the project and make it move forward. Personally, I am totally okay with Google controlling the language as long as it remains open-source and they listen to other contributors.

One language to rule them all

By introducing Dart on Android, Google would fill the only remaining gap in the Google development ecosystem. Dart already lets developers create applications for the web and servers. Porting Dart to Android would be the final stone to the house. Indeed, it would make Dart the only programming language that runs on all majors platforms: mobile, web and servers. One step closer to the “write once, run everywhere” motto that all software companies want to achieve.

Finally, Dart is an opportunity to simplify the Google development languages offering. Indeed, Google has been working with many languages in the past: C++, Python, Java, Javascript, etc. The Dart language could be the crossroads where all languages combine making Google products/services SDKs even more consistent and coherent.

Rocket launching Dart to space

Dart is awesome and has been out there for several years now. Unfortunately, it hasn’t yet reached the critical mass to be considered as the inevitable programming language in web development. This is mainly due to the fact, web developers don’t seem to think that Dart brings enough improvements to make switching worthwhile. Making Dart the default language on Android will be the best way to push the language to the next level and finally make it a first-class citizen in the landscape of programming languages.

Asking developers to use a brand new language is always a difficult move at first. However, it is way more motivating when you know the language you are about to learn can be used on other platforms. As an Android developer, I would be very happy to use Dart on Android and be able to easily create a small web site whenever I want.

Conclusion

Pushing Dart to Android obviously implies Google will have to work hard in order to solve things such as performance, compatibility or interoperability. How to make sure Dart runs as efficient as Java of constrained devices while it has been originally developed for desktop web browsers? How to make sure new Dart-based apps run on a majority of devices? By embedding a DartVM only on Android 4.5+1 devices? By transpiling apps to Dex with a dart2dex utility? How to let people use Java APIs in Dart and vice-versa?. All of these questions are difficult to solve but that is where Google excel: finding smart solutions to overcome issues. If, just like me, you think Android should switch to Dart, you can star issue #19266 on the Dart bugtracker. Google I/O is around the corner and I’m waiting for the June 25th keynote to hear Google reveal everything about the future of Android. Google, it’s time to be brave. Let’s start a new journey by deprecating Java and unveiling Dart as the new programming language for Android apps.