Kotlin vs Java
On the occasion of the last Google I / O, its annual conference for developers, held last May, Google has announced the official support of Kotlin language in Android. The decision was greeted by a thunderous applause. It is true that Kotlin was already supported by the mobile OS, but this decision tends to reassure the developer community. It translates indeed a clear will of Google to perpetuate the presence of this language on its platform alongside Java. "Even if he does not officially admit it, it is quite clear that Kotlin Google intends to push Java to the exit," said David Wursteisen, consultant in the French service company Soat.
An "industrial" environment
Kotlin offers a very seductive approach. Published in open source (under Apache 2.0 license), it is a very flexible language, both object-oriented and functional - based on static typing. Compared to his big brother Java, Kotlin translates into a much less verbose semantics. Within its syntax, it integrates various devices to make its expression concise (type inference, disappearance of NullPointerException, destructured declarations ...). "Via an extension method mechanism, you can for example complete APIs without having to modify the underlying objects," says Soat's consultant.
Comprehensive compatibility with Android
Unlike many other programming languages, Kotlin is not from academia, but from industry. It has been developed since 2011 by the Czech software publisher JetBrains. "Hence its very effective approach," said Arnaud Dupuis, CTO and co-founder of Genymobile, a company on the initiative of the famous open source Android emulator Genymotion. "Kotlin is an interesting alternative to Java, which remains heavy, verbose, and poorly designed, even if its latest version (Java 8 ed) introduces a lot of improvements and simplifications."
In this industrial logic, Kotlin has also been designed to be fully compatible with Java. Compilable for the JVM (the Java virtual machine), "a Kotlin component can be called from code written in this language, but the opposite will also be possible," said David Wursteisen. A bridge that at the same time helps to facilitate application migrations from one language to another.
Rich tools
Is Kotlin easy to handle? For little to already master Java, C # or Scala, "this language can be learned in a few hours by reading the reference documentation," said Arnaud Dupuis. "The environment is free to focus on functional or object-oriented development, it's very convenient, and it's easy to migrate all or part of an existing Java application to Kotlin." It will not be necessary to change the code review process, so there is very little risk in adopting Kotlin, knowing that JetBrains has every interest in continuing to invest in the development of its IDE. "
Tooling side, Kotlin does not arrive empty handed. JetBrains offers an award-winning Java code editor (IntelliJ IDEA) with a Kotlin plugin. The official development environment of Google (Android Studio) is itself based on this IDE, so he also natively supports the language of JetBrains. Kotlin extensions also exist for the main Java IDEs (Eclipse and Netbeans). Just like for Maven or Gradle build software. And framework side, Spring begins to take the path of Kotlin.
"In terms of code analyzers, on the other hand, there are currently not many suitable solutions, and some Kotlin extensions for SonarQube are just starting to be shared on GitHub," says David Wursteisen. Finally, Kotlin is compatible with the JVM, the simulation tools usually used by Java programmers will continue to work.
A language still young
Note that Kotlin can also be compiled in JavaScript, which opens the browser door. "JetBrains recently announced the possibility to compile Kotlin natively, which should make it easier to open to other types of runtime, and why not iOS," says David Wursteisen. Arnaud Dupuis ponders: "Kotlin arouses interest on Android to the extent that, beyond its intrinsic qualities, it is compatible with this operating system, as well as with the main existing Java development tools. "iOS, the situation is very different.It exists a vast ecosystem already in place on this field, very captive, which can not be jostled so easily."
It remains to be seen whether Kotlin will eventually be able to supplant the development of Java applications on Android. "It will be necessary