The plug-in to save you - (from Scala to Kotlin)

The plug-in to save you - (from Scala to Kotlin)

If you’re in the software engineering business, you’ve probably noticed some companies want to integrate apps originally built in Scala with Kotlin. There are numerous reasons for that to happen and we’ll explore some of them, but first let me start with? a real-life example – Baker, my current assignment at ING.?

Baker is ING’s open source project (https://github.com/ing-bank/baker), a microservice orchestration engine originally built in Scala. As a consequence of the Scala to Kotlin migration at ING, our team started getting requests to include better support for the latter in our product. To accommodate the demand and make the integration with Kotlin easier, we decided to build a Kotlin DSL.?

Quite soon we realised that in order to accomplish our plan we had to include kotlin code in the SBT build setup of the project. In our first attempt, we made use of the 'sbt-kotlin-plugin' built by https://github.com/pfn. Unfortunately, this version was neither up-to-date nor compatible with the latest variant of SBT. Our solution was to first fork the plugin and then fix it as a next step. The result of our efforts is now publicly available on Maven Central under the Flock Community namespace: https://github.com/flock-community/kotlin-plugin. We have to say it works very well, so please feel free to use it for your own projects.?

The recent transition from Scala 2 to Scala 3 turned out to be not a simple upgrade, but almost a new language altogether. And although there are undeniable benefits to the new Scala version, such as a powerful static type system and metaprogramming facilities,? there are also some issues with language instability and an unproven compiler. To address these concerns, some experts, such as John de Goes, CEO of Ziverge, propose a Scala Resurrection. In his blog https://degoes.net/articles/scala-resurrection he says: “We need a coordinated campaign to rectify known weaknesses, and shore up emerging strengths. Such a campaign will not be easy. It will require discipline, collaboration, and sacrifice, acting with a sense of common purpose for the greater good of all.”

Companies relying on Scala might not have the time to wait for the resurrection however. They start to realise that upgrading their applications to Scala 3 will be costly, time consuming and perhaps not even tangible – proficient Scala engineers are hard to find.

While I have always appreciated Scala for its ability to enable concise code and its usefulness for pure functional programming, I never failed to appreciate the benefits of Kotlin. Developed by a company called Jetbrains to address the limitations of Java, it has gained significant popularity due to its excellent interoperability with major Java frameworks such as Spring, Quarkus, and Micronaut. Nowadays, it’s gaining traction in the commercial sector, too, with companies such as ING moving away from Scala/Java and choosing Kotlin instead. So although a resurrection sounds compelling and definitely a great opportunity to reach new Scala heights, more practical solutions are worth considering, especially in business settings.?

Of course, the decision of which programming language to use will ultimately depend on the needs of the project, but given the recent developments around Scala, I believe Kotlin is a safer option. The community around it is stable, pragmatic and friendly? so I’m of the opinion that Kotlin is a viable alternative to a Scala 3 revolution.

要查看或添加评论,请登录

Flock.的更多文章

社区洞察