3 ms·
They talk in this article about the complexity of Scala. Odersky typically combats that accusation by saying that Scala's not so complicated. He did that in t
by unoti 16y ago
They talk in this article about the complexity of Scala. Odersky typically combats that accusation by saying that Scala's not so complicated. He did that in this article, and I've seen him and others do the same in other places.
But the fact is, it's pretty damn complicated. At least it was, to me, but I realize now that's just because I didn't grok functional programming in the slightest. Scala seriously turned me off at first, and I found it very hard to learn. There's a lot of little tricks it does, and special rules. Like how there are many different ways do progressively shorten inline function definitions. For example: you can either say: "args.foreach(arg => println(arg))", or you can say "args.foreach((arg:String) => println(arg))", or you can just say "args.foreach(println)". And the books I have explain that in kind of a complicated way that explains partial functions way sooner than I was ready to understand. All those different options of ways to do things made me have a hard time understanding what the "right" way to do things was. Similarly, the ability to do ultra-shortcuts on inline function definitions really confused me at first, for example being able to say map(_ + _) instead of (a,b => a + b).
For loops were also kind of bizarre to me. I remember thinking, "Jeez, would it kill you to just let me write a frickin loop for goodness sake?"
I perceived all this as excessive trickery and complexity in the language, and decided to bite the bullet and learn Erlang, instead. Erlang is a far, far easier language to learn. It was a breeze, actually, once I relaxed and forced myself to embrace it instead of hate it. (I failed to do so on a previous attempt to learn it.) In the process, something amazing happened: I started wishing that I had access to a lot of those things that I initially hated so much about Scala. I started wishing that I could write map(_ + _) instead of writing map(fun(A,B) => A + B end, L) like Erlang was forcing me to do.
Point is, if you're finding Scala off-putting or overly complex, like I did, then consider taking the time to learn functional programming with Erlang. You may even decide you like Erlang better. Erlang is better for some kinds of applications and situations. But for me, I found it way easier to learn Erlang first. Because until I was forced to do pure functional programming, I didn't appreciate the value of it. It prepared me to really appreciate Scala.