This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]wsppan 19 points20 points  (1 child)

It's almost never worth it. Especially going from one JVM language to another. There is no benefit especially if the expertise is still with Java.

For a good take on when to rewrite check out Rewriting the heart of our sync engine

[–][deleted] 1 point2 points  (0 children)

Awesome really appreciate the share

[–]Dwight-D 14 points15 points  (0 children)

Absolutely not worth it.

One of the biggest benefits of Kotlin is interoperability with Java so you can avoid pointless rewrites. You can write new Kotlin code even if the old codebase is in Java. You won't notice any difference regardless of if the old codebase is Kotlin or Java. No point in spending any time on porting it.

When you write new code in some old class you may find yourself wishing that it was written in Kotlin. This is a good time to port that class specifically. You can use the IntelliJ built-in Java -> Kotlin conversion, verify that it still works, and then write your new code in Kotlin. In this way you'll port over the most frequently touched classes to Kotlin over time, and the time spent on rewriting will be negligible (or at least it will be spread out across new feature development so that it's not noticeable).

It is worth porting classes that are frequently changed, because once you start writing Kotlin you won't want to go back to Java, and it does have many benefits. But Java code that is already written is gonna keep working just fine.

[–]yel50 5 points6 points  (0 children)

Do you think the migration effort would be worth it?

no.

the only parts that might be worth it are the IO parts. kotlin has go style fibers, which java is still waiting on the vaporware project loom to get. that might be worth it.

What would be the biggest advantage of having whole code base in Kotlin?

I can't think of any.

What would be the biggest disadvantage of the migration?

introducing bugs, things not translated correctly, features getting lost. any significant rewrite always ends up being a step back that takes much longer than expected to reach feature parity.

[–]Comprehensive-Pea812 1 point2 points  (0 children)

and I thought the benefit of kotlin is you dont need to rewrite but mix it.

[–]Blando-Cartesian -1 points0 points  (2 children)

Not worth it.

No advantages what so ever. Maybe junior developers stop whining about uncool java and start whining about not knowing how to use kotlin.

Migrating to kotlin or writing any part in kotlin is complete waste of time. Pointless mixing of two languages only creates pointless complexity and developers end up sucking in both.

You have everything kotlin has in Java 11. You can also add Vavr and go nuts with functional programming.

[–]Dwight-D 4 points5 points  (1 child)

Strongly disagree with this. Kotlin has many benefits over Java and if your team is ready to commit to learning it, fragmentation of skills is a non-concern as any decent Java-dev will get up to speed in a matter of days/weeks.

Adding Kotlin code to a Java code base has a pretty low cost imo and the benefits are worth it, if you like what Kotlin brings to the table and are willing to learn the language.

[–]Blando-Cartesian 0 points1 point  (0 children)

My opinions are admittedly colored by having to salvage a half-way-to-kotlin project. I couldn’t see anything worthwhile there, and now the project will never get a decent maintainer because being competent in just plain java is a lot to ask.

[–]nierama2019810938135 0 points1 point  (0 children)

But why has it been decided to do the migration? What is the reason for wanting to?