Hacker News new | ask | show | jobs
by mathattack 3749 days ago
I'm curious - is the harder part of learning Scala the language itself, or getting one's mind around functional programming itself? (Does having a Scheme/LISP background help?)
2 comments

For me, I grasped most of usage of the language fairly quickly, from a standpoint of working functionally. I think there are a couple parts of Scala that are intimidating to beginners.

First of all, there's a lot of choice in how to organize a solution to a given problem. Say you've just started to grasp the idea of algebraic data types and manipulations thereof. You might still find it hard to know how to apply it in a given situation, because there are several ways to do it [1]. As you gain experience, you start to get a feel for which option is more appropriate in a given situation.

Secondly, a lot of the basic concepts of Scala are super general, so you can sometimes see language elements used in ways that are surprising. In my experience, you start to build a mental model for actual usage of language elements, but it's still intimidating at first. See this question and answer about the `object` keyword [2].

But then, even as you master the language, there are all sorts of little gotchas you learn to navigate. This is true of any language of course, but it can be more frustrating when you're operating at a higher level of abstraction. The Dotty project seeks to rewrite the Scala compiler in line with an improved framework of some of the more innovative type system features of Scala. I think it's ultimately going to lead to a better foundation with less gotchas. But it's still a long time coming.

Oh yeah, and the `implicit` system is a beautiful concept, but pretty unique to Scala, and intimidating at first.

[1] http://stackoverflow.com/a/26690131/807674

[2] http://stackoverflow.com/a/28036272/807674

I was a long time hobby level Common Lisp and Clojure programmer when I started learning Scala. Understanding functional programming before coming to Scala definitely made it easier. That said I think Scala has a little extra learning curve because you need to understand some syntax especially around type declarations, and understand how flatmap and map work, not just on lists but on many different kinds of data structure.
It doesn't help that Scala takes a lax attitude towards functional principles whenever it's convenient -- for instance, you can map over a set, and certain maps will get you a different type back. Haskell it's not. It's more like a terse Java with optional types and pure functions added on.