|
|
|
|
|
by qwerta
4642 days ago
|
|
I wrote about 10kloc in Kotlin for internal testing framework. It is heavily multi-threaded and Kotlin aced here (compared to Scala). Java8 brings lot of legacy stuff. It feels like authors just wanted to add 'functional' on feature list. No type inference or named arguments. I think it is better to compare Kotlin to Groovy or Scala. In both cases it is simpler and more elegant language. I found two problems with Kotlin: Not mature yet. It is surprisingly stable and bug free (compared to Scala just 4 years ago). But some features are not designed yet and are missing (for example getters handling). Those will be added in some future milestones. Also I had to write some boiler plate code which should be in standard library. Nullability handling is strictly required. Most of classpath API is already annotated, but I had to annotate external libraries I am using. |
|
There's a lot of merit to the "Java philosophy": a gradual progression of what most programmers expect in a language. Google, for one, seems to have adopted the Java philosophy wholeheartedly in its new languages Go and Dart.
Kotlin is certainly in that camp: a gradual progression that will make programmers happier yet won't turn their world upside down. It's simply a better Java. So while Scala unfortunately evolved from being a better Java into the mother of all kitchen sink languages (assuming, of course, that your kitchen feeds a whole military base and has sinks the size of hot tubs), trying to cram Java, Haskell, Lisp and Javascript into a single compiler (I find it hard calling Scala "a language"; it's more like a compiler that compiles code written in any of several languages), Kotlin takes a few steps back and comes up with a coherent philosophy.
I think 99% of Scala users will find Kotlin to provide 100% of their requirements, and at a much reduced complexity and mental load. So Kotlin, I think, is not only a better Java, but a better Scala.
Yet, I think Java 8 will be the game to beat, for Kotlin as well as Scala. Java is hugely popular, and those that haven't migrated to other JVM languages so far, might be less likely to do so when Java 8 comes out. With lambda expressions and traits – the two killer features that attract many to Scala when it first came out – it gives Java a nice boost. Sure, Kotlin feels more like a fresh start, and has some other necessary features (properties), but will those be enough to switch people away from Java?
I think that one of the great achievements of Kotlin's design, though, is that the transition could be very gradual. Kotlin places a very strong emphasis on Java interoperability (leaps and bounds better than Scala's) and unlike Scala, Kotlin code is easily read by Java programmers. So teams would be able to easily replace individual Java classes with Kotlin code.