Hacker News new | ask | show | jobs
by zzalpha 3319 days ago
But it doesn't seem better enough to force old Java dogs to care for new tricks.

Don't count on that.

I'm an old dog when it comes to Java. But I decided to give Kotlin a try on a little pet project of mine.

JetBrains are mad geniuses. In Intellij, with a hotkey you can convert Java to Kotlin. A couple of Alt-Enters and you have something almost idiomatic.

I converted the entire (small) project in an hour and then spent a bunch of time reworking parts to take advantage of Kotlin's functional features.

And I could convert incrementally and test each migration because the Java interop is absolutely seamless. They've completely eliminated the risk and friction of trying the language out.

I even found a bug along the way due to Kotlin's null checker.

It's brilliant!

JetBrains gets it. They produced a language that's new yet familiar (sorry Clojure), powerful yet still easy to understand (sorry Scala), and has essentially zero barrier to entry due to interop and tooling support.

1 comments

> JetBrains are mad geniuses. In Intellij, with a hotkey you can convert Java to Kotlin. A couple of Alt-Enters and you have something almost idiomatic.

The same works for Scala.

> powerful yet still easy to understand (sorry Scala)

Kotlin is way less powerful than Scala. And if you dumb down Scala to Kotlin level by just not using the more advanced features (it is easy to turn them off globally), you're basically writing Kotlin. I can't see how Scala is less readable then - the differences are really cosmetic.

I find Scala suffers from similar problems you find in Haskell or C++: an overly complex type system, obsession with operator overloading, way too many ways to do things leading people to find a "manageable subset" they can deal with. Like Haskell (and its many extensions), it feels a little too much like a language that was designed by throwing nifty ideas at a wall without cutting out the stuff that didn't stick.

Add in the slow compiler, sbt (I don't need another build system, thanks), and IDE support that's only finally decent, and speaking for myself, it's not my thing.

Fortunately, it is the nature of the Java ecosystem that we can pick the language and tooling we prefer and we can all still get along! So while I'm a fan of Kotlin, hey, if Scala is your bag, enjoy!

Scala has no operator overloading. You cannot blame language on somebody picking bad method names. There are plenty of bad names in Java and Kotlin libraries as well.

> an overly complex type system

It is only as complex as it has to be to solve problems it was designed to solve. I take a more complex type system that make complex problems hard to solve rather than a simplistic type system that make complex problems impossible to solve.

> it feels a little too much like a language that was designed by throwing nifty ideas at a wall without cutting out the stuff that didn't stick

Name a few that could be removed without making the language significantly less powerful. Most people saying "Scala is complex" really want to say "Scala has many concepts I'm unfamiliar with". Java or C are also "too complex" for most VB programmers.

> Add in the slow compiler

It is not as bad as you may think, and IDE support is stellar, so I don't need to compile really that often. Many successful languages have much slower compile times: C++, Rust. Incremental compilation is fast enough. I get typically 1-5 seconds compile times.

> sbt (I don't need another build system, thanks)

SBT is not mandatory. Just a tool. Pick whatever you wish. Scala works perfectly fine with Gradle or Maven.