read


read
or learn more

Scala is for drivers

Sep 2, 2011

this post inspired by Volkswagen’s excellent marketing campaign ‘Drivers Wanted’

An unfortunate meme1 dogging Scala is the notion that it is a notoriously complicated language. For better or worse, I do believe that the lion-share of this general perception is fueled by both fear and lack of familiarity. That’s not to say that Scala doesn’t have its share of complexities, instead the fearful perception doesn’t map to the realities of the language experienced after consistent usage. Having said all of that, I think it’s important to note that Scala is designed to solve very hard problems and because of this there is a definite set of highly abstract ideas that, if one is unfamiliar with it or languages like it, possess a very sharp learning curve. However, an important point to ponder regarding learning curves is this:

The complexity of a language cannot be defined solely in terms of the pain felt in the initial stages of learning.

— me

Let’s try to attach a picture to this idea.

Scala’s cliff of insanity

If someone (me again) familiar with both Scala and Java were to describe the complexity curve of the former it might look something like this:

scala-cliff

A description of this image could be described as such:

  1. The initial smoothness is indicative of a simple, low-ceremony "Hello World" example and the fact that it is super-easy to write Java-flavored Scala
  2. The massive spike is indicative of the reality that Scala is a very powerful language chock full of powerful abstractions, syntactic flexibilities, and paradigm-ness2
  3. Eventually one comes to learn how the powerful features can be properly used and how robust and maintainable Scala code is constructed
  4. However, another spike hits when one learns that the powerful abstractions are building blocks for even more powerful abstractions
  5. Eventually, the complexities of the language itself become second nature, make sense in the context of the whole, and stay out of the way,3 leaving one to concentrate on the problems at hand

This complexity curve is indicative of the most powerful programming languages.4

Java’s cliff of inanity

If someone familiar with both Scala and Java were to describe the complexity curve of the latter it might look something like this:

java-cliff

A description of this image could be described as such:

  1. The initial smoothness is indicative of a simple, but ceremonious "Hello World" example and the fact that Java is designed for ease of introduction 5
  2. The moderate spike is indicative of the reality that good object-oriented programming is hard
  3. However, while the complexity curve’s slope decreases, it continues to climb. The reason for this is that Java is chock full of incidental complexities, language foibles, and type system inconsistencies
  4. Alas with the help of powerful IDEs, one can eventually come to gripes with the foibles. However, the language never gets out of your way. There is a definite, tangible limit to the abstractions provided by Java and these limitations constantly impose additional complexities on the already complex problems one is trying to solve

This complexity curve is indicative of partially powered programming languages.

Cars

I can’t stand cars. Nothing is more boring to me than car talk. I like a car that will get me from here to there with reasonable fuel efficiency and safety. That’s it. I can appreciate the beauty and power of an Alfa Romeo 8C Competizione, but it doesn’t serve my current needs.

The height of enterprise offerings

However, if I ever have the need for a fast get-away6 then my car will fight me at higher-speeds and then eventually simply break-down. Clearly my car is not designed to meet the needs of a fast-paced environment and because I’ve never had such a need neither am I.

Scala is an Alfa Romeo.

Drivers wanted.7

:F


  1. FUD? 

  2. My language has more paradigms than yours coming soon to a t-shirt near you. 

  3. That’s not to say that there is no room for improvement in Scala’s handling of powerful abstractions. For example, the hoops required to facilitate the use of type classes in Scala are extremely cumbersome. Scala would be better served by a first-class syntactic treatment of type classes, but I alas I have not thought this through to its logical end and am ready to be convinced otherwise. 

  4. Some of these powerful programming languages are found in my blog post about Perlis Languages

  5. A alternative, but wholly inflammatory way to describe this post can also be stated as: Scala helps programmers solve hard programming problems – Java helps human resources solve staffing problems. But I thought this might be a little over the top. Funny yes, but definitely over the top. 

  6. No one expects the zombie apocalypse. 

  7. However, there is a lot of effort spent on the matter of Scala’s perception of complexity. I’m of the opinion that those involved in its development and marketing should just step back and say “Yeah. So what? So is Spring. Programming is hard and only set to get harder and Scala can help you meet these growing complexities.” Any time spent on the development of Scala that does not directly benefit “drivers” is time wasted IMO. 

27 Comments, Comment or Ping

  1. G. Ralph Kuntz MD

    Are you thinking of writing a book about Scala next?

  2. Wanted: Clojure’s curve! Interestingly different in my experience. Similar to Scala, it has the second bump (and maybe more after that) as you continue discovering new ways to create abstractions.

  3. Prafulla

    Inspiring post indeed. Scaling Scala is something i’ve been wanting to do since a while and your post has fueled the urgency all the more.

  4. Casper Bang

    Interesting description. However you fail to cover what happens to existing code bases. The nice thing about Java is that any Java expert can pick up an existing code-base fairly easy, whereas I don’t believe quite the same to be the case for Scala. Any problem can be solved by adding another layer of indirection… except the problem of too many layers of abstraction! (David Wheeler)

  5. I think clojure start with the sharpest initial curve cause its syntax. It offers almost no bait to the programmer who prefers to go in the back seat of the car. Having overcome the phobia of the parenthesis, the curve drops suddenly and is more like scala.

  6. Kar

    That’s an unfortunate car analogy. The Alfa Romeo 8C, while bewitchingly beautiful, is also a bit of dog when it comes to driving it – here’s Top Gear’s former Stig on the car :

    http://news.drive.com.au/drive/motor-news/the-stig-the-five-worst-cars-ive-driven-20110428-1dxa0.html

  7. tt

    Why would you quote yourself in the beginning paragraph? It makes you look like an ass.

  8. @Alex

    I anxiously await your blog post showing your personal Clojure curve. :-)

  9. Brian Horblit

    Yesterday I stumbled upon David Pollak’s “Yes Virginia, Scala is Hard” article. Last weekend I had looked as some pretty painful Scala, and was in a mood to agree with David. But after thinking last night about the fact that I had written a bunch of production Scala code, trying to be reasonably functional (but very much not totally functional), using Actors for some critical concurrency, and I never really felt that the language itself was “hard.” I had purposefully not spent a lot of time on some of the more gnarly syntax, which some day I really need to nail down, but then I didn’t really need it to write what I felt was pretty decent code that solved a non-trivial problem. The effort to productivity ration was quite reasonable. So I love your article, and it resonates with me much more than David’s does, upon reflection. I might lower your first bump a tad, and raise the second bump a tad, but otherwise I think you are spot on. Thanks for the thoughtful piece and the spot-on driver analogy :-)

  10. petar

    Ironically, the person who wrote the “Scala meme” is one of Scala’s longest users, the creator of Lift. So neither “fear” nor “lak of familiarity” apply.

  11. “Learning is pain!”

    Also, we might simply say that some programming languages allow better leveraged effort: http://sethgodin.typepad.com/seths_blog/2005/03/godins_leverage.html

  12. How would you draw the complexity curve of Perl?

    How about C++?

    Both of those languages are notorious for their complexity, and chock full of some kind of abstractions, syntactic flexibilosity (of some ilk), and paradigm-ish-ness.

  13. Very good post. I agree with the Scala learning curve. When I first learned scala and looked (for example) at the Scala collection API my only thought was “WTF?” but now that I am relatively familiar with Scala, having read a bunch of books and some source code and programmed many small examples, it gets easier and easier and the language gets more and more out of a programmers way and let’s you focus on the problem itself. I had a similar experience with Ruby.

  14. @tt

    Why would you quote yourself in the beginning paragraph? It makes you look like an ass.

    That’s the part that makes me look like an ass?

  15. @petar

    Ironically, the person who wrote the “Scala meme” is one of Scala’s longest users, the creator of Lift. So neither “fear” nor “lak of familiarity” apply.

    I didn’t mean to draw a direct line to Mr. Pollack’s post regarding fear and familiarity, only the general complexity meme. I think Mr. Pollack’s post is driven by something else entirely, but only he would know for certain.

  16. @R. Kuntz MD

    No.

  17. @Casper

    The nice thing about Java is that any Java expert can pick up an existing code-base fairly easy

    I call B.S. There is much more to any codebase than the implementation language.

  18. configurator

    Not in Java there isn’t. Any Java codebase is an insurmountable obstacle that even close knowledge thereof wouldn’t help overcome. Therefore, a newcomer to the project is in just as good a position as an existing developer to continue the painfully slow progress. To quote Prof. Sussman, “There is no such thing as a simple Java program.”

  19. I need that shirt.

  20. You should submit the paradigm shirt idea to ThinkGeek: http://www.thinkgeek.com/brain/customer_bounty.cgi

  21. JustMe

    I totally disagree on the Java learning curve. Depending on your background OOP may be totally alien to you and writing a simple hello world program requires that you create a class context and within that context you remove the OOP aspect again with a static main function.

    Java’s biggest problem is that people thought that OOP will be a good way to look at all problems. But it isn’t. Especially for most beginner problems that are too trivial to be worth a class or even inheritance.

    That being said: Java has a lot of great features, but as someone who starts Java, you first have to tackle a lot of concepts that will mostly be useless when writing small programs.

  22. Bad parallel with a car. Alfa Romeo breaks even faster than it drives.

  23. patrick logan

    if only your blog could dispense beer for this discussion…

  24. dds

    Scala, just as virtually all the other functional languages are, is for retards who can’t grasp oop and can never produce real world, useful software.

  25. spangiafora

    Scala is for retards who can’t grasp OOP? And why, exactly, should we take the word of a dentist for this?

  26. Arthur Ulfeldt

    I refer to the parts of Java (or any language) that must be present even when unused and or not understood as the intellectual overhead

Reply to “Scala is for drivers”