Dreaming Mobile: Kotlin to rule them all!

Jorge Coca
3 min readNov 5, 2017

--

Last Friday finished the first edition of KotlinConf, and it was a total success. We’re talking about a language that, within a year probably, went from being an underdog, to be considered now “the language”. Everyone seems to love it, from old school Java developers to even our Swift/iOS colleagues. Kotlin is here to stay, and JetBrains has really ambitious plans for it.

Kotlin-Native and multiplatform projects

When Google announced Kotlin as a first language for Android, the community celebrated with enthusiasm the announcement. What we did not know back then, is that JetBrains does not want Kotlin just to be the modern replacement for Java. They dream big. Really big. So big, that they want Android, iOS and JS to be written in Kotlin. To compile in Kotlin. And to share code between platforms.

Yes, you heard me right. During KotlinConf, JetBrains announced the support for Multiplatform Projects (at the moment only supports JVM and JS compilers) and the version 0.4 of Kotlin-Native. Now, you can do the math… what is the next logical step? My two cents are multi platform support for native projects. And the implications of this are simply huge!

We’ve dreamed about writing once, and shipping to many platforms, with different solutions and results: PhoneGap, Cordova, Xamarin, ReactNative… but all of them had a problem; when it was not performance, was the fact that you are behind the latest APIs, or that you have to use JavaScript…

But JetBrains is putting on the table, from my point of view, the most elegant solution: write your apps with Kotlin, that will run everywhere, and you will be able to share and reuse a lot of your code, but still accessing the platform APIs. And even interoperating with other languages, like we do now between Java and Kotlin.

So, imagine this: you work on an Android and iOS app, and you can follow this approach:

  • Write your service/repository layer on Kotlin, but it is platform dependent: on iOS you might need to access CoreData, while in Android you could use DBFlow for your storage and in a desktop client you might use in-memory storage. But then, the API exposed can be abstracted from the particularities of the platform, and be generic enough to be platform independent.
  • Share your view models, presents, reducers… whatever architecture you use, can be shared between platforms.
  • Write UI for your platform. If you want to keep it native, go for it… if you want to even go one step further and reuse as much as possible, you could even use React Native.

So, as you can see, Kotlin is not a framework or an abstract solution to the problem, but the fact that you are still writing native code, with all the Kotlin benefits, opens the door to more possibilities than ever.

I totally believe that Kotlin-Native is the “future” of development, and that it will be a game changer for mobile in particular.

--

--

Jorge Coca

Android engineer at @bmwna. Born in Madrid, living in Chicago. I have watched La La Land more times than you… and I love singing and dancing in public xD