Thursday, March 20, 2008

A New Year's resolution

The start of each year invariably makes us look back and wish to bring more purpose to the next year. So did I have an improved New Year's Resolution? Of course- 1280x1024. A bit more significant, though, was to find another programming language to learn this year (following the sound advice from "Pragmatic" Dave Thomas).

Since we geeks can sometimes be programming language junkies, this was harder for me to do than previous years. I've previously improved my knowledge about Perl(2004), Python (2005), Tcl (2006) and Ruby (2007). They served their purpose but this year I felt it's about time to depart a bit from my comfort zone and try a new concept. As someone with much more experience noted, "A language that doesn't affect the way you think about programming, is not worth knowing".

So I did my homework and did a bit of research and nominated the following languages:
  • Scheme: yes I've done some functional programming in the university and I've edited an Emacs Lisp macro or two, but if you're not using it, you're losing it. Besides, I've always wanted (and postponed forever) reading "The Little Schemer", which has an almost cult status.
  • Logo: This elegant language is sometimes referred to as "LISP without the parentheses". I did some research about which programming language I should start teaching my son first (yeah I know it's ridiculously early to do that before your son is even born!) and decided that LOGO is the all-time favorite kids' programming language. Of course, being famous for its graph-drawing turtle does not mean it can't be used as a serious language. Anyway, it would be a pity if I don't learn it some day, given my relatives with some years of research on Logo.
  • Haskell: One of the most exotic in this mix, Haskell's lazy evaluation and monads sound novel enough to be fun to learn, besides it's getting some moderate popularity and there is even real-world software written in Haskell, like the Perl 6 compiler/interpreter and revision-control system Darcs (OK, Perl 6 is not a real-world software yet).
  • Erlang: One of the promises of Erlang is that it can deliver one of the easiest concurrency programming models with message passing between lightweight processes. Besides, it seems to be a fairly simple (compared to Haskell at least) functional language, while still preserving power features like pattern matching. Last, but not least, I really like hot class (module?) reloading and compared to the hot swap feature in the JVM it is really much more pervasive, so much easier for debugging, monitoring, quick fixes, etc.
  • Scala: It's not just object-oriented and it's not just functional, because it's a language with many influences- it even has pattern matching and Erlang's message passing model for concurrency. One of the best advantages is that it works on the JVM and integrates seamlessly with existing Java libraries.
  • Groovy: This is another promising dynamic language on the JVM, which seems to draw a lot of its influence from Ruby, including a Rails-like webapp framework, called Grails (surprising choice of name, huh?). Since my professional work is related to Java, I might learn this sooner or later because I think we would be seeing more from this (we already are). Especially for working with XML builders seem to be making things much smoother.
Interestingly, along with my new big-resolution display came a dual-core processor. Everyone knows that multiple cores will be all over the place soon. So my curiosity about how you can make these multiple processors scale based on the programming language model itself, took over. That leaves Erlang and Scala.

Of course that's not all of it. Logo's time just hadn't come yet, as my son is too young for me to start seriously teaching him (hell, he doesn't even know a human language to start with). Groovy could wait as well and it shouldn't be hard at all to pick up with Python, Ruby and Java behind my back. Erlang might be an easier first step into serious functional programming than Haskell and Scheme... well I guess I can postpone it for one more year and make do with Emacs Lisp.

But which one should it be- Erlang or Scala? Erlang is recommended by the same Pragmatic Dave who is responsible for me learning Ruby. And Scala's creator, Martin Odersky, is the man behind Java Generics and the current Java compiler.

But you know what? I didn't have to decide (or I might have learned none of these). My brother has the uncanny ability to guess what I want for a present, so he got me Programming Erlang from the Pragmatic bookshelf. And my father has the great ability to ask me what I want for a present, so he got me the Programming in Scala from Artima.

Eventually, I must have done a fairly good job on my language research because my list was not very different from the one in an article about new languages on Dr.Dobb's Journal.

On a side note- ordering PDF books is great- you can search easily, you don't destroy trees and you get the updates of new revisions easily- go for it!

So there I am, with two languages instead of one for this year, although Erlang and Scala have a lot in common. With the surge of interest in new programming languages one language per year only might take me forever to cover all I wanted to learn.