?

Log in

No account? Create an account
Previous Entry Share Next Entry
Programming as art: Scala's new Collections API
device
jducoeur
Okay, this one's for the hardcore code geeks in the audience; anybody else will find it eye-glazing. But if you really love code, check out the Scala 2.8 Collections API. It's a thing of beauty, and a really good illustration of why I so love Scala -- they systematically deconstructed every major collection type, figured out exactly what they have in common and what makes each one different, and rebuilt the libraries to be about as consistent and sensible as is humanly possible. (They were already way better than average in 2.7, but they nonetheless rewrote it under the hood to make it all *right*.)

The result looks about as close to perfect as you can get: as many common base traits as possible (making everything more learnable and robust); focused on immutable collections (for safety and scalability) while allowing you to work with mutable ones whenever you feel the need; lots of consistent operations, so very-high-level functional programming Just Works; abstractions that let you seamlessly work with infinite collections exactly the same way you do finite ones; thoroughly type-safe from top to bottom, using Scala's type inference to catch programming errors without you needing to state types explicitly. I could go on, but you get the idea.

I sometimes talk about programming as my artform, and I mean that quite seriously: I perceive the aesthetics of code just as clearly as I do for painting or music. The Scala project has won me as an adherent on that basis, perhaps more than any other -- there is a common devotion to crystalline elegance in both the language and its tools. That lets me program *better* on a practical level, but beyond that, it's just plain more *satisfying* a language to work in...

  • 1
Probably an artifact of timing -- release 2.8 just came out, and the tooling support may still be rough around the edges...

  • 1