Could Google’s Dart dethrone Java on Android?

Is Android due a new main programming language?

At WWDC 2014, the Apple’s annual developers conference, the guys from Cupertino showed to the world their new programming language: Swift. Swift is an evolution of the old Objective-C and will make it easier to develop iOS Apps.

After this presentation, some people started to claim that Android is getting out of date, from a developer perspective, compared with its main rival iOS. The reason they give is that Google should leave Java behind and base their OS for mobile devices on a different language; one which is more efficient and easier to use.

One language to rule them all

And the language that seems to be the main candidate to substitute Java on Android is called Dart.

Dart is a open-source programming language developed by Google. It was intended to replace JavaScript as the main language used on web development but it has potential to become the language used by Google to work with Android.

Currently, it allows developers to build applications for both the web and servers. Making it run on Android could make Dart the first language to run on the web, servers and mobile devices.

First dive into Dart

Dart has been inspired by languages like SmallTalk, C#, Java and Javascript. It aims to be a “new, but yet familiar language” so its learning curve is extremely easy for anyone used to working with those language. Here are five of their most interesting features.

1. Optionally typed

In Dart we aren’t obliged to type our members. This is really useful when prototyping an idea we have on our mind. We can write a first version of the concept without using type annotations and later, when we are happy with what we have wrote, add type annotations. These two code snippets are semantically the same:

recalculate(origin, offset, estimate) {

recalculate(Point origin, num offset, {bool estimate: false}) {

2. Collection literals

In Dart is easier to work with collection than in Java as we can declare lists and maps as literals. We can see an example of a simple list:

var fruits = ['apples', 'oranges', 'pears'];

and a simple map:

var accounts = {'322532': new Account('Bob'), '43534345': new Account('Alice')};

3. Clean syntax

Compared with Java, Dart offers a cleaner syntax; one which is less verbose. For example, we have a reserve word for constants (const), so there is no need for long strings of keywords like private static final.

public and private are not part of the language as a member will be public by default and private if its name starts with an underscore.

4. Pure OOP

Unlike Java, Dart is purely object oriented. That means that everything is an object. Everything. We don’t have any primitive types like int or boolean as we do with Java. Even null is an object.

5. Source code VM

Like Java, Dart is a VM-based language. That means that it runs over a virtual machine.

But even here Dart is different from Java. In Java we use the .java files to compile into a binary .class file which will be executed by the VM.

Dart’s VM is capable of executing the source code, so there is no need to compile it first into a binary.

The future of Dart

Today we don’t know if Google will make Dart the future of Android, but in my humble opinion, it would be a step forward in the evolving process of Google’s ecosystem.

It would bring uniformity across different platforms such mobile, web and servers and provide an enhanced tool for developing Android Apps.

Dart has been built keeping in mind the idea of fixing current and recurrent development problems without extra effort from the developer, and that is what makes Dart a really serious candidate to dethrone Java on Android.

Leave a reply

You can use these tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Sign up for the Manifesto newsletter and exclusive event invites