Search This Blog

Tuesday, April 12, 2016

Kotlin during Android Developer Group Poznań (ADG) meetup

Last week I presented STX Insider project at Android Developer Group meetup in Poznań, Poland (ADG). It’s entirely written in JetBrains’ new programming language Kotlin. The presentation was focused on technical aspects of the code, mainly on nullpointer safety, interoperability with Java, final value preference, nullable types and extension functions. After the talk, participants had the chance to answer a few questions about the language.

One can draw the following conclusions from the survey:
  • developers are intersted in Kotlin but most of them haven’t written anything in it yet
  • they see the potential but aren’t ready to abandon Java just yet

Event details (ADG Poznań):

Presentation slides:

Thursday, April 7, 2016

Kotlin advanced - language reference for android developers

Kotlin - one of the popular programming languages built on top of Java that runs on JVM.

As a mobile team we got interested in Kotlin a few months before its final release which gave us time to test it thoroughly before production use. The language has some clear advantages for an Android programmer - it enables migration from Java projects that have been under development for some time already. Java&Kotlin coexistence simplifies Kotlin introduction as only new functionality is written in JetBrain’s new language leaving all the legacy code untouched.

Transitioning gives the developer an opportunity to use lambdas, new syntax for data objects, extension functions to easily expand Android SDK’s classes functionality and infix notation to write DSL-like structures. Almost all the libraries you use today will work with Kotlin thanks to 100% Java compatibility. The same is true for Android SDK classes - all of them will seamlessly work with the new programming language. Kotlin gives you more choice when it comes to reflection, creating documentation and being null-pointer safe. Android works great with it out of the box so you won’t need to change your development habits.

Our production project in Kotlin turned out to be a success after 4 months of development. We had 0 bugs related to Kotlin as a programming language. Our code footprint is almost 30% smaller thanks to JetBrain’s, we benefit from nullpointer safety, closures, translated enums, data objects and use infix notation for logging and displaying Snackbars.

Kotlin advanced - language reference for android developers

Second talk on Kotlin language we had at STXNext. We try go deeper into language specifics and look at the positive impact new syntax can have on boilerplate removal and readability improvement. Kotlin really shines in Android development when one looks at “Enum translation”, “Extension functions”, “SAM conversions”, “Infix notation”, “Closures” and “Fluent interfaces” applied to lists. The talk, however, compares language-specifics of Java & Kotlin in terms of “Type Variance”, “Generics” and “IDE tools” as well.