We wanted to iterate on a lot of the software structure we came up with for our Swift iOS app, and for a bunch of pieces we needed a powerful type system. So rather than just stick with Java -- as others have said, it's way too verbose, we started looking at alternatives. We wanted a strong type system. Scala has too much overhead for Android. Kotlin really stood out for us. This document by Jake Wharton at Square https://docs.google.com/document/d/1ReS3ep-hjxWA8kZi0YqDbEhC... made the decision easier. So we took the risk.
And we love it!
The best features:
Null type safety!
Lambdas can be inlined! No need to be afraid of anonymous inner class overhead on the map/filter/fold of iterables.
Reified generics!
Extension functions!
Single-method interfaces/classes can be represented as lambdas! aka
view.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) { /* do something */ }
});
becomes view.setOnClickListener { /* do something */ }
This is great for things like RxJava.Speaking of which, the Java interoperability is fantastic. Any Android libraries we've tried work great from Kotlin.
Using these tools, we've built a simple dependency injection framework, a handful of really useful extensions on things like T? (for example monadic bind), a hack for algebraic data types and pattern matching, and of course a fairly complex app.
Android Studio's Kotlin support is fantastic (good job JetBrains!) -- it's a pleasure to use.
I think Kotlin is totally worth using. The biggest issue for us is the build time. Our build takes anywhere from 1.5 to 6 minutes depending on how much you've changed, but I've found that the type system is strong enough that you don't have to do too many build-change a line-rebuild cycles.
We'll be starting a blog soon to talk about some of the stuff we've been doing, but if you can't wait send me a message bkase at highlig.ht if you're interested in hearing more (I love talking about this stuff)