3 ms·
>How well does Kotlin perform on Android? Can you use all the native stuff? Not only is Kotlin a great language, it is also a good fit for Android since it ou
by on_and_off 11y ago
>How well does Kotlin perform on Android? Can you use all the native stuff?
Not only is Kotlin a great language, it is also a good fit for Android since it outputs bytecode and is entirely interoperable with java.
The only cost of using Kotlin are the 6k methods that it adds to the apk. You can call all the native Android APIs. Of course they are not idiomatic kotlin code, but you can cope with that, especially since the Kotlin team has written some Extensions methods in order to facilitate this process.
>Are there some successful apps written in Kotlin?
I know that Expedia uses some Kotlin for its new features (since there is full interop, you can switch gradually).
I am working alongside 12 or so other engineers on a successful Android app. Most of us (especially the more experimented) would like to switch to Kotlin but we get a lot of resistance from an extremely change averse team leader (we have just convinced him to start using EventBus and are still pushing for Dagger 2 & Rx).
This kind of move is always complex for a large team though. You need to get everyone on board and up to speed with this new language. Even though I think that kotlin is very easy to learn (especially for a java dev), this is still a significant effort.
- V-2 11y agoPersonally I think a good way to set a foot in the door (with Kotlin) is to use it for unit tests. Hey, unit tests aren't production code, so what's the worst that can happen, right? Plus in many projects - sadly - tests are still perceived as an optional thing. And Kotlin is very well suited for tests, because it's so expressive, DSL-friendly etc. There's also this pleasant framework: http://jetbrains.github.io/spek/ http://jetbrains.github.io/spek/ If you can't convince your team (or bosses) to switch to Kotlin, start writing unit tests in Kotlin. They can even coexist with Java ones, so I believe this is an easy way in. And once people get to see it at work...
- on_and_off 11y agothanks, that's an interesting idea. we already have started making more and more tests several months ago (the code base we inherited is awfully architectured and entirely untested), I will try to win over our test engineer with that idea.