grobid icon indicating copy to clipboard operation
grobid copied to clipboard

Are we interested in introducing Kotin language for development?

Open elonzh opened this issue 1 year ago • 4 comments

There are several reasons why Kotlin is a great choice for Java projects:

Interoperability: Kotlin is designed to be fully interoperable with Java, which means that you can use Kotlin code alongside existing Java code seamlessly. This makes Kotlin an excellent choice for projects that require compatibility with existing Java codebases.

Concise syntax: Kotlin has a much more concise syntax compared to Java, which means that you can write code faster and with fewer errors. For example, Kotlin can eliminate boilerplate code that is necessary in Java, such as semicolons and getters/setters.

Null safety: Kotlin is designed to be null-safe, which means that it is less prone to null pointer exceptions. This is because Kotlin has a built-in null safety system that makes it easy to write code that avoids null references.

Functional programming support: Kotlin has excellent support for functional programming concepts such as lambdas, higher-order functions, and immutable data structures. This makes it easier to write code that is more expressive and easier to reason about.

Coroutines: Kotlin has built-in support for coroutines, which is a powerful concurrency feature. Coroutines make it easy to write asynchronous code that is both easy to read and efficient.

Better tooling support: Kotlin has excellent tooling support, including a plugin for IntelliJ IDEA, which makes it easy to develop, debug, and deploy Kotlin code.

Overall, Kotlin is an excellent choice for Java projects because of its interoperability with Java, concise syntax, null safety, functional programming support, coroutines, and better tooling support.

elonzh avatar Mar 17 '23 16:03 elonzh

Hi @elonzh !

@lfoppiano and I were discussing about it recently and indeed we were thinking to switch as much as possible to Kotlin now for development involving some (existing) Java environment, for all the good reasons you are listing! Kotlin is really convincing and I am only starting to discover its potential (I am always quite late in anything).

So for Grobid specifically, we could start mixing like this https://kotlinlang.org/docs/mixing-java-kotlin-intellij.html.

kermitt2 avatar Mar 18 '23 08:03 kermitt2

IDEA supports converting Java code to Kotlin and I have been using this for a while, it's pretty helpful in introducing Kotin language for legacy Java code.

Kotlin is my first JVM language because it's productive and I am using it to modify Grobid for some needed parts. If Kotlin is on our roadmap, maybe I can make some contributions.

elonzh avatar Mar 18 '23 09:03 elonzh

I haven't written much new code in Java recently, but we should kick it off in grobid to start rolling the ball.

lfoppiano avatar Mar 28 '23 01:03 lfoppiano

@elonzh I think one way to speed up the integration of kotlin in grobid would be to send a PR with the changes in gradle (I guess we need some changes in the gradle). After that I can help spreading it :-)

lfoppiano avatar Apr 07 '23 07:04 lfoppiano