Hacker News new | ask | show | jobs
by ajnin 3147 days ago
I'm glad more frameworks follow the simple and concise way of Spark.

However, why support both Java and Kotlin, it seems that would create more work with no real need ? Admittedly, I've been burned in the past with Play! which said they would support both Java and Scala but using the Java version I always felt a lot behind in feature support.

2 comments

It's not that much more work. You have to be careful with a few concepts (like SAM/Functional interfaces), but most of the time you can just write in Kotlin. I want to support both because a lot of companies are probably like the one I work for, where there are a lot of java-devs, and a few of them are pushing for kotlin. This seems like a good compromise to me.

Play was two different projects tho? There is only one Javalin source.

There is only one for play as well
Okay, poorly worded. I think (please correct me if I'm wrong) that in play you have distinct parts of the code-base that are for Java developers, while other parts are for Scala developers.

In Javalin, although some parts are written in Kotlin and some parts are written in Java, there is 0 duplication. If one part is written in Kotlin, both Java and Kotlin developers use that part. If a part is written in Java, both Java and Kotlin developers use that part.

That is correct. There are 2 separate APIs (that come from a single project). This is because Scala can support a bunch of functionality that Java (and Kotlin) can't support (type classes, higher kinded types, etc.). So your options are to hamstring the API for Scala or have 2 separate APIs.
From looking at the codebase, looks like there isn't any explicit "support Kotlin and Java", because most of the code's written in Kotlin.

Also, Kotlin and Java are meant to be well interoperable, so the Java support sort of comes by default. So it won't be the same as Scala + Java. I've been burnt by Apache Spark which has an awful Java API compared to Scala (and Python).

If someone has a better answer, I'd love the education :)