Time to move away from Java?

Prathik Rajendran M
2 min readJul 27, 2019

--

I get infuriated when people walk up to me and discuss moving services away from Java. It is generally because they see the sugar coating of the other language but not the true utility.

Hate towards Java is nothing new. The C/C++ purists have hated it when it started and now folks from hip language of the month club hate it.

The criticism Java faces from the hipsters is about it’s verbosity. This is a fair criticism. I am not a fan of verbosity in Java.

Now the verbosity problem isn’t a problem anymore with tools like Lombok. IntelliJ live templates also write most of the things for me. For example, I have a live template called `jtest` which writes the test boilerplate for me.

With the coming in of local type inference in Java 11 long declarations aren’t a problem either. You use `var = new X()` and Java infers the type for you.

Streams API and Lambdas have made languages like Scala obsolete for me.

In almost all cases I’ve had better performance with Java. Given my background, it is easier for me to tune Java over tune Kotlin or Scala.

Some cool new feature comes along in a new language but then the coolness fizzles out or Java gets the feature.

Kotlin is doing interesting things. Coroutines? have a counter part in Java via Fiber from Quasar library. Both of them seem like bytecode black magic thus I avoid them. It’s a good feature to have but even for the scale we deal with I have not seen a good fit.

Kotlin has an interesting approach towards null safety. Every Kotlin developers who has every asked someone to move away from Java talks about this. My approach to null safety is a simple live template called `prnn`. It adds a `checkNotNull` that and often. In my 7 years of coding I’ve never faced an error due to NPE. This happens since I write through units and use the live template on all public methods.

If you are a Java developer don’t move to these languages. There is incremental improvements via syntactic sugar. Lombok and IDEs solve that. Java is moving towards less verbosity as well.

If you are a new developer pick any but know that Java has a lot of problems solved already. It has 20+ years of history (which has it’s pros and cons). Someone would have faced and solved your problem already.

Aside: The only language that seems worth moving towards right now is Go. The reason is that compiled languages will make a strong comeback given that we have docker. Using docker we can run the compiled code anywhere and thus it acts like JVM. Among the top compiled languages Go seems to do most of the things well.

--

--