Re:From zero to 10M lines of Kotlin
by origin_path on Tuesday October 25, 2022 @01:15PM
(#33333425)
Well, the new Android UI framework (Compose) is fully based on Kotlin and coroutines.
> built-in optional typing
Typing is not optional, everything in Kotlin is typed. What the language has is type inference. The following lines have the exactly same types:
val teens = people.filter { it.age < 20 }.map { it.name }
val teens: List<String> = people.filter { p: Person -> p.age <= 20 }.map { p: Person -> p.name }Just for comparison’s sake, java is not significantly more verbose.
final var teens = people.stream().filter(p -> p.age < 20).map(People::name).toList()Keep in mind, you can use Kotlin in any JDK8 project and instantly get all those features. What you're proposing requires upgrading to a new JDK.
Upgrading to a new JDK is significantly less work than upgrading all your tools to support a new language.
I've only used Kotlin on Android, but from what I remember co-routines are not necessary to use. If you don't like them, then don't use them.
Kotlin has a number of advantages over Java. The biggest of which is built-in optional typing. It's also really nice that everything is expression instead of a statement. Library functions like `let` also make code a little nicer to write. And stuff like data classes and better property initialization are icing on the cake. In my opinion, you can write Kotlin exactly as you would Java, but the development experience is much more polished.