Hacker News new | ask | show | jobs
by 0xCMP 1733 days ago
I'm not a huge fan of Java, but a lot of the improvements being worked on here are promising.

I'm 90% certain I would only really start working on a project if we could use Kotlin just because the ergonomics are vastly superior. If that requires the trial-by-error mentioned ITA to figure out the best practices of various approaches available I think I'd take that trade off.

2 comments

I've been using Kotlin since 1.0 but I have to say the ergonomics of it are not vastly superior to Java.

As others have mentioned, with Kotlin you're pretty much limited to Jetbrains' IDE, you have a new runtime dependency, not just a compiler, which is rapidly changing and requires updates on the code base frequenly (one of my projects used Kotlin for testing with KotlinTest - which recently changed names to KTest I think - and it was horrible to have to re-write most of my hundreds of tests to be able to upgrade when they went from JUnit 4 to 5 and in the process re-wrote all of it, basically), the compiler is slower and it starts to feel very much once you have thousands of lines of code... not to mention that there's a fairly big overhead of not only having to have javac installed, but also the Kotlin compiler and standard library... also, you probably want to use Gradle with the Kotlin DSL which in my view is really, really slow and unpleasant to work with - though they've finally been improving this recently - in the last couple of years.

So, yeah, I like to write Kotlin code better than Java, but due to all of these factors and the fact that Java is now fairly close to Kotlin in functionality, if I had to start a big project today, I would pick Java for sure.

Have the ergonomics of Scala improved with version 3?

I‘m planning on revisiting Scala at some point

Yes, a large part of Scala 3 was explicitly about improving ergonomics and making language features clearer to use. Some examples of this are:

- Greatly improved error messages [1]

- Revamped implicit syntax that makes it more straightforward to declare type classes and extension methods. [2]

- Simplified support for macros [3]

[1] - https://www.scala-lang.org/blog/2020/05/05/scala-3-import-su...

[2] - https://dotty.epfl.ch/docs/reference/contextual/type-classes...

[3] - https://docs.scala-lang.org/scala3/guides/macros/index.html

optional braces if you are into that sort of thing. https://docs.scala-lang.org/scala3/reference/other-new-featu...