DEV Community

Discussion on: Scala, Kotlin, or Grovvy? Which Programming language Java Developers Should Learn?

Collapse
 
jillesvangurp profile image
Jilles van Gurp

For new programmers, I'd focus on Kotlin and then maybe Scala and ignore Groovy. The reason is that Kotlin is gaining a lot of momentum in the backend world where Scala has maybe ran out of steam a little. E.g. the Spring project recommends it, and it is also the language of choice for Android. A couple of things that make this language stand out: 1) co-routines and Flow are a nice step forward for asynchronous and reactive programming. 2) kotlin native and kotlin-js mean that Kotlin is becoming a full stack language that you could use outside the JVM.

Scala is very different from Java/Kotlin/Groovy in the sense that it seems more focused on functional programming. It depends on your domain. If you are doing a lot of data processing with e.g. Spark, Scala may be the better fit. You might want to look at Clojure for the same reasons. It's worth noting that people in the Scala community seem worried about core committers jumping on the Kotlin bandwagon: reddit.com/r/scala/comments/8xreuv...

At this point, Kotlin is a natural successor to Groovy that removes most of the need for both Groovy and Java. It has most of the nice language features but without the complexity of being a dynamic scripting language. I know quite a few people that are switching from Groovy to Kotlin at this point. I see very little reason for anyone to pick Groovy for a project.

Collapse
 
javinpaul profile image
javinpaul

Great comment and advice but I think for a new programmer it's to start with Java or Python. I have also blogged about it java67.com/2018/07/is-java-best-pr...

Collapse
 
jillesvangurp profile image
Jilles van Gurp

I'd argue most Java programmers need to consider if they want to stick to Java when Kotlin is pretty much a drop in replacement that people are literally dropping in Java projects to replace it. I've done a few of those and the language is designed from the ground up to facilitate that and be better than Java at literally everything it does. It's a better Java in every way that counts.

Thread Thread
 
javinpaul profile image
javinpaul

It depends, learning Kotlin is definitely a good option but you won't always get a chance to replace existing Java project with kotlin, not at least on big Investment banks and Insurance firms where most of the Java run nowadays. I would stick to Java and just add Kotlin in my arsenal rather than making it my primary skill, but again that's my thought.

Thread Thread
 
lemuelogbunude profile image
Lemuel Ogbunude

My thought as well...

Thread Thread
 
jillesvangurp profile image
Jilles van Gurp

Sure, those kind of environments are a bit slower to adjust. Unless you want to work in such an environment, you might want to look at what they will be doing in five years; which I'm betting will be mostly Kotlin because it is a drop in replacement on all of their Java stuff now already.

Short term having a Java background will help you understand Kotlin. But I have a suspicion that the JVM as a runtime will become less important as the native compiler and cross platform libraries mature.

Thread Thread
 
lemuelogbunude profile image
Lemuel Ogbunude

Sure Kotlin is cool but as Paul has stated, a lot of Java developers would just add it as part of their Arsenal. I have spoken to other Java developer, especially those who had already experienced the "shiny" Kotlin features on other languages such as Scala and the rest, they are not necessarily as excited about Kotlin as Android developers.

Kotlin's major market is Android and the issue with Android isn't Java, but that the developers are stuck with Java 7-ish features.

The companies using Java should focus on trying to use the latest Java features, it's very likely those companies are using Java 8 or even Java 7. They could upgrade to the LTS JDK 11 and use the latest features instead of migrating to a new language. I feel it's not a necessary action.

In the next five years, Java would still be kicking and kicking even harder, it's great to have additional Languages like Kotlin and Scala in the JVM, these languages have the luxury to try out features and see if it works, Java learns from their experiments, Java does not have that luxury because of the number of systems depending on it, the stewards of Java have to make sure a feature is needed before adding it... and a lot of very cool features are on their way.

I see the JVM languages as an awesome team rather than competitors.

Thread Thread
 
jillesvangurp profile image
Jilles van Gurp

You are wrong on that it is an Android only thing. I use it on the backend. Lots of Java backend frameworks are moving towards either supporting/recommending Kotlin or even porting to it. E.g. okhttp just released a fully backwards compatible v4 that has been completely ported from Java to Kotlin. Spring is recommending Kotlin over Java and optimizing their frameworks for Kotlin. Spring probably represents about half of the industry; particularly enterprise/fintech setups.

If you are planning to do work involving Spring 5.2 and up, you should be planning to move to Kotlin as they are adding co-routine support in Spring 5.2 and it makes the flux/reactive mess they released a while back a lot more user friendly. IMHO any new Spring Kotlin project will be much more likely to use Kotlin than Java very soon. Any new project that isn't is doing it wrong.