Scala a Write-Only Language

The Scala language is intriguing, quite powerful, but tends toward being illegible when written “properly”. I’m not at all convinced that the average software developer is able to grasp Scala. At least, not beyond the basic abilities that could just as easily be expressed in Java. Heck, from what I can tell there are a lot of software developers who find Java to be beyond their full comprehension.

Interesting read. I’ve only played with Scala for a few hours a while ago, and I attended a nice introductory talk by Markus Völter; from this, I got the impression that Scala is cool but complex. Some of Doug’s criticism seems to be founded in a lack of familiarity with (or resistance to) FP idioms, but he still seems to have quite a few valid points.

No direct resistance to FP idioms, but an indirect resistance. I don’t think that the “average” developer is going to understand the FP idioms, or at least not all of them. If the code that I write contains an idiom that another developer can’t understand—or worse, misunderstands—that’s a problem.

British vs. American idioms (amusing to Americans, anyway):

He: "Can I knock you up in the morning?"
She: "No, give me a ring instead."

As the section that you quoted above alludes to, I’m reading a lot of complaints that Java 5.0 (especially generics) pushed the complexity of Java beyond the ability of many Java developers, and that the closure proposals only promise to make things worse. If generics are too complicated for developers to understand, and closures are even worse, then what the heck are those developers going to do with monads and catamorphisms?

I think that there’s some real value in nudging developers toward using immutable data. But that’s going to be hard enough—many Java developers today find the immutability of java.lang.String to be infuriating. Going full-out FP is, in my opinion of course, not going to be accepted for some time to come.

Essentially, idioms that are currently not part of one’s language always seem weird. It all depends on what people are used to. The example you gave seemed slightly weird to me, too, but more for syntactical reasons. E.g. in Ruby it would be

def sum(l); l.inject {|sum, value| sum += value }; end

For a Ruby programmer, the inject call is totally idiomatic, and the iterative way would simply feel weird (like somebody programming Java without using classes).

It also seems to me that being easy for Java programmers is a Scala non-goal, but I may be wrong.

Finally, I believe many of Java problems arise because it has grown and remained backwards-compatible — a language cleanly designed from scratch would never look this way.

About

This is a post from Stefan Tilkov’s blog, originally published
on January 4, 2008. For more up-to-date content authored by me, check out my author page at innoQ which has more information about me and contains a list of published talks, podcasts and articles.