Let me first say that I am a Scala lover and have been a Scala champion for almost 5 years. I’ve written books and articles on Scala. I’ve worked with dozens of companies that have launched Scala and Lift projects. I’ve code reviewed many dozens of Scala projects.
I used to think that Scala was easy. It was, and continues to be, a cure for some of the numerous problems with Java. From the “stuff that’s hard or impossible in Java is simple in Scala,” Scala is a very easy language. Dealing with collections is super easy in Scala. Isolating business logic making programs much more maintainable is vastly easier in Scala than it is in Java.
So, why is Scala hard? Here’s the best list I can come up with:
– Scala tries to be too many things. This means that you can code it like Java which is a curse and a blessing, but I think over the long term, it’s a curse. It means there are too many debates about OO vs. FP. These kind of decisions/debates are okay if you’re a small team, but they really suck when you’re trying to teach Java developers to write Scala when they don’t really want to learn. The overwhelming advantages of Scala really manifest themselves when you’re coding mostly FP, but it’s nearly impossible to get OO developers there unless they really want to get there. In this case, less language features/choices (like Java or Ruby) is easier. It makes for less choices.
– IDE support is weak and always will be. The Eclipse plugin for Scala (or whatever it’s called this week) sucks. It has sucked for the 5 years I’ve been doing Scala and it’s always “just about to get better” but it sucks. IntelliJ’s Scala support is reasonable for me. But the folks who need patterns in their IDE will not find the Scala support good. For one, the Scala patterns as so diverse and disjunct (OO via mixins all the way to ScalaZ), there will
be too many patterns/templates. If you’re happy coding in Emacs or Vi or TextMate, Scala is okay and moving to IntelliJ is nice. If you’re expecting the hand-holding that you get with Java IDEs, it isn’t there and never will be because encompassing Scala’s power with simple paradigms is difficult and requires tons of resources that even TypeSafe with $3M in the bank cannot underwrite.
– The Scala type system is tremendously powerful, but it’s in your face way too much. In the ScalaDocs, the type signatures are just plain frightening. Look at flatMap [B, That] (f: (A) ⇒ Traversable[B])(implicit bf: CanBuildFrom[List[A], B, That]) : That and tell me that doesn’t make you want to run screaming. This is a method that beginners use every day, 20 times a day and it’s way too intimidating. Scala documentation needs a library consumer more that hides the complexity that is going on which in practice makes flatMap simply amazingly powerful. The type system and associated documentation needs a simpler mode that hides the features that trade power and complexity at the library level for simplicity at the end user level.
– Junior developers who are asked to maintain code written by senior developers have to understand the idioms and patterns in the code. While Scala makes putting business logic at the forefront of the code (rather than distributed through a bunch of for loops and complex if statements), depending on the idioms used, decoding that logic is non-obvious. This is a variant of the lack of idioms issue, but at the end of the day, you need a team with a mind-meld to grok some Scala code.