Advantages of the Scala language

18/09/2015 11:40

What's good:

  • Strong static typing with automatic output of types, like in Haskell or SML. The impressions from programming are the same as from programming in Haskell - if the program is compiled, there is hardly any mistakes. Especially, if you specify more flags -Y, giving the language more austerity.
  • Despite the austerity, Scala is easy and enjoyable as the script languages. About Haskell I definitely cannot say the same;
  • Very nice and laconic syntax. This is especially noticeable in the book “Learning Spark”, which provides examples of code in Java, Scala and Python. The code in Scala always gets the same length as the code in Python, and two times shorter than the code in Java. In addition, the code on Scala and Python is much more readable;
  • Functional programming with immutable variables, lambdas, circuits, tuples, lists, and so on. Due to the widespread OP code becomes much easier to maintain, plus writing of multi-threaded code is greatly simplified;
  • Once started talking about multi-threading, here we have the actors, who are no worse than the actors in Erlang. In contrast to the approach in mutexes and atomic variables, writing in multithreaded code on actors is an entire pleasure. Racings, deadlocks and many other problems go away by themselves. Also, the actors give the programmer a lot of convenient ready primitives - monitoring of other actors, examples, reset in the case of unforeseen errors (let it crash). Without actors you need to invent this yourself.