Previous Entry Share Next Entry
Layers of Scala
There's a fascinating argument going currently on the scala-debate mailing list. (One thing I love about Scala is this list: an open forum for debating the language's evolution that neophytes like I can participate in, but which is heavily made up of the language's movers and shakers.) A newer Scala programmer started things off by arguing that Scala is simply too big and complex for junior programmers to learn. I countered fairly early in the thread that that's not really true, but that you want to focus on the language features appropriate to what you need, not bite off the whole thing at once. And today, Martin Odersky (the man principally responsible for creating and driving the language) made a similar point in much more detail.

His response was useful enough that I'm going to preserve it here (I hope he's not offended by the copy -- since the post is in an archived mailing list, I assume it's not considered private). The following isn't hard-and-fast (people immediately started quibbling with the details, of course), but it's a good rough guideline to the "layers" of the language, depending on what you're trying to accomplish, and is likely useful to anybody trying to learn the language.
It's an intriguing question. I believe the answer will differ a little bit for everyone, but I'll put up a strawman nevertheless. I assume here that programmers have already a good knowledge of Java, so we can take at least pre-generics Java for granted. If that's not the case, some of the early concepts such as classes and exceptions need to be moved to more advanced levels.

Also, I distinguish between application programmers and library designers, because the required skill sets are radically different.

So here's something for y'all to knock down ;-):

Level A1: Beginning application programmer

Java-like statements and expressions: standard operators, method calls, conditionals, loops, try/catch
class, object, def, val, var, import, package
Infix notation for method calls
Simple closures
Collections with map, filter, etc

Level A2: Intermediate application programmer

Pattern matching
Trait composition
Recursion, in particular tail recursion
XML literals

Level A3: Expert application programmer

Combinator parsers

Level L1: Junior library designer

Type parameters
Lazy vals
Control abstraction, currying
By-name parameters

Level L2: Senior library designer

Variance annotations
Existential types (to interface with Java wildcards)
Abstract types
Self types
Structural types

Level L3: Expert library designer

Early initializers
Implicit definitions
Higher-kinded types
Defining map/flatmap/withFilter for new kinds of for-expressions
Later conversation made the point that the levels aren't quite comparable -- for example, L1 is probably similar to A2 in absolute difficulty. But in general, I find this list hugely sensible and very *useful*, especially in providing a guideline of the language features that neophytes are probably well-advised to stay away from unless they're really eager.

I will note that I, Mr. Armchair Language Geek, haven't yet mastered the A3 level, and I'm nowhere near L3. There *is* a lot there -- but the point is that you can be very productive without needing to know all of it...

  • 1
Very cool. Scala is the next language I have decided I must learn, only problem is free time (or lack there of) and a project to do.

Always the problem. Languages are fun and interesting, but without a driving project or practical application, it's hard to justify devoting the time and resources.

Says the guy who hasn't been called on to do anything beyond A0.5 in years.

  • 1

Log in

No account? Create an account