Wednesday, June 25, 2014

Is Scala the C++ of the Java world?

I have spent considerable time learning Scala. Read a few books, wrote some code. It is not a bad deal - you get the world of Java, all its libraries, all the code ever written in it - all wrapped in a nice object-oriented and functional approach.

However, the complexity of the language seems daunting at first. There are many exceptions, catches, constructs and assumptions in the language. No matter how many books you have read and how much code you have written, it always feels like you missed something, maybe a chapter in some book or some feature that could have made your code better or prettier or completely different. Many libraries outside what comes with the language are half-baked, in a state of flux, they all seem to be built differently. There are multiple frameworks for doing simple things, they all have some advantages and some drawbacks over the competition. Then there is SBT - where to begin with that one? ;-)

People keep saying more choice is better but what if many of the choices are half-baked or in a state of constant, never-ending flux? I will quote an old German proverb: "He who has a choice, has the doldrums".

Then there is Play 2, Akka and a myriad of other outside frameworks almost as complex (if not more complex) than the language itself - many of them trampling on each other by re-implementing some of the functionality of the other. Add to the mix ScalaZ - hey (!), I thought Scala was already supposed to be functional! ;)

At the end there is the question of being just able to sit down and write what works without much boilerplate and rituals to basically satisfy the compiler or the build tool. Python allows it (and I do not particularly like Python), C is easy, heck, even writing a piece of code in x86 assembly with gas/ld is easier and faster to get going!

So, why stick with Scala?

This article briefly outlined the negatives. In the next article I will weigh in with the positives and discuss whether it is just better to stick to Java or go the extra step and invest in learning Scala. I will also try to answer the question of why I brought in the (admittedly nasty) comparison to C++.