Why Java Programmers Should Avoid Scala

I have been writing Java professionally since 1997 and while the JVM (Java Virtual Machine) continues to dominate enterprise development, that is not all that has kept me using it. I have always liked Java.

A while ago I was chatting about how I found some aspects of Haskell and Go really interesting, when BeepDog mentioned Scala. Well, at the time I felt I had no need of Scala because

If I wanted to use the JVM I would use Java, and if I did not want to use the JVM I could use Go, Haskell, or whatever other language best fit the needs of the project.

But then I did not know Scala. An EPFL Coursera class, Functional Programming Principles in Scala opened and being out of excuses, I took the class. I was so impressed that I took the next one, Principles of Reactive Programming, too. There is no fitting exclamation, or emoticon to describe the experience.

I can’t list all of the advantages of using Scala on the JVM, because I keep finding new ones. Here are a few just to get things started.1

  • An improved, static type system

  • Native support for Functional Programming

  • Native support for Object Oriented Programming

  • Clever concurrency solutions

  • A more concise and expressive syntax

  • Runs on the JVM fully interoperable with Java.

Scala classes can call Java methods, create Java objects, inherit from Java classes and implement Java interfaces.

Scala Language Specification Version 2.8

The above advantages and more makes Scala the pragmatic choice for productive, maintainable, DRY, and performant code on the JVM platform.

So with all those advantages, why avoid it? Because something happens when you learn Scala…

I continue to experience situations where I find some aspect of the Scala syntax or some framing of a problem awkward only to have an epiphany. The result of the epiphany is an astonishing change in my way of thinking. Avoid Scala because once you learn it you will be forever changed and will never again approach problems the same way. Scala is improving, and promising languages appear all the time. Who knows where the journey will end.

If you are content with using the JVM just as you do now then please stick with Java, but stay away from Scala. ;-)

  1. There are many more, simply search the web… Many people even explain why these characteristics are advantages, I will save the space.

Mark Mynsted

Comments