Ruby? Scala? Scheme!

As a programmer you should learn a new programming language once in a while to keep yourself flexible and open to new ideas. After lots of Java coding at work, it was time for me to take a step back and try something new. There were quite a few languages to consider, but after a brief evaluation phase I ended up with Scheme, much to my own surprise.

The Establishment

I’ve come across a lot of programming languages over the years, not just the well-established ones. Like most people with a computer science background, I can pick up a language quickly – and forget all about it two weeks later. Some languages make a permanent impression, however, and I continue to use them.

Here are the ones that made it; some stayed for their qualities, others because there was simply no way to avoid them:

  • C taught me about pointers, system-level programming and the Unix lifestyle in general. I learned about memory leaks, segfaults, and that you don’t have to aim carefully to shoot yourself in the foot.
  • Perl was my introduction to the world of scripting languages. It showed me the power of regular expressions, that beauty is in the eye of the beholder and that a programmer can get used to anything.
  • Python proved to me that a dynamically typed language can be both productive and elegant. It also demonstrated that language evolution is possible without having to start from scratch.
  • Java is the language I used for learning object oriented programming and design. It showed me that a language doesn’t have to be exciting as long as its environment is rich and well-designed.
  • From C++ I learned that language design is an art that is better not left to amateurs.

A good language changes the way you think. It helps to get a new perspective and has an impact on how you work with other languages: the ones you know already and those you learn in the future. For example, some object oriented techniques found their way into my C code, and I look for regular expression support and functions as first-level objects in every new language.

The Contenders

I was trying to find an interesting, special language that was different from the ones I already knew. My language of choice had to be somewhat minimal in syntax and concepts, lean, elegant and a pleasure to use. However, it should still be expressive enough to get work done although it didn’t have to be immediately useful for my job or open source projects.

Fortunately, there were many contenders:

  • Ruby is certainly interesting: Truly object oriented with functional features, in some aspects even more elegant than Python. I didn’t choose Ruby because it’s not different enough from Python and Ruby on Rails has lost its appeal recently.
  • Scala has received a lot of hype lately and might in fact be a way to get life back into the Java world. I’ll keep an eye on it, but if it does have its breakthrough some day I’ll learn it anyway.
  • Groovy seems to be a "me too" language, with features stolen from Java, Python, Ruby, Smalltalk and probably others. I fail to see the things that make it special. Its syntax is certainly not minimal.
  • C#? Well, no .NET-based languages for me. Not for fun anyway.
  • Erlang is famous for its concurrency features, but it feels a bit too much like a niche product, even for me. There aren’t many books to choose from, and that was essentially the knock-out criterion.
  • Haskell and languages from the ML family, like OCaml were all tough competitors. At university I had some exposure to Gopher (a Haskell dialect) but wasn’t impressed too much.
  • The Lisp family of languages with Common Lisp and Scheme has always been a mystery to me, ever since I tried to learn Emacs Lisp and failed miserably. I simply wasn’t ready back then and didn’t know lambda calculus.

The Winner

The choice was a difficult one. Most languages I considered had something special about them and I even started to learn a bit of Ruby because its elegance got to me. Then I read about Scala during the Java closures debate and realized that my understanding of functional programming concepts wasn’t exactly solid.

Sure, I use a few concepts in other languages like Python (see Functional Programming HOWTO for Python). However, in multi-paradigm languages you tend to fall back to the programming paradigm you’re most familiar with, so I wanted a pure functional language to avoid diversions.

I chose Scheme because it’s more minimal than Common Lisp and there are great books: The Little Schemer teaches Scheme in a series of questions and answers – a truly unique approach that works surprisingly well. I’m about half through and had a lot of fun so far. And there’s The Scheme Programming Language which is available online in full text.

Knowing Scheme itself will probably never be immediately useful. But hey, that’s not the point! What I want at the moment is a deeper understanding of functional concepts. I’m sure I can transfer that knowledge to other languages.

This entry was posted in misc and tagged , . Bookmark the permalink.

7 Responses to Ruby? Scala? Scheme!

  1. Andrew McVeigh says:

    I spent about 5yrs with scheme as my 2nd language (after C++). It was interesting. The best learning book I found was Structure and Interpretation of Computer Programs (Abelson and Sussman), a very deep book. One job i did had an exam where they gave me questions out of that book — bizarre. The book is good because it develops the foundations of things like laziness (futures + promises), meta-circularity etc.

    Another language/environment that is definitely worth checking out is Oz/Mozart. It’s a multi-paradigm language, but this includes logic variables and functional concepts which makes it fairly unique. Nice tuple syntax also.


  2. Giorgio Malagutti says:

    Although I agree with you on the analysis I will choose Scala for pragmatic resons.
    Scala allows you to have all java libraries at your fingertips and is very likely to have spread IDE integration in 3 months from now.
    I want to be able to state that in 8 months from now I have completed a real world project in a new breakthrough language and with Scala I feel that I have a real chance to reach my goal.

  3. mafr says:

    A colleague of mine recommended “Structure and Interpretation of Computer Programs” just the other day so I’ll definitely give it a closer look. I generally prefer printed paper, but it’s also available online in case someone else is interested.

  4. Ryan says:

    Just a note, Scheme is not purely functional, but definitely a good choice to learn. I do not know Haskell, but from what I have read, it is purely functional.

  5. Andrew W says:

    There are a lot of really good free texts online including SICP, Teach Yourself Scheme in Fixnum Days and TSPLv3.

    I, like you, have recently discovered Scheme and have started using it in my job for prototyping web applications. I formerly used Ruby on Rails for this but was always hampered by the lack of integration with Java of which we have lots of legacy code. I’ve been using SISCWeb which is a continuations based web framework that runs on a JVM and can be packaged as a WAR file. Once you’ve got the hang of Scheme – SISCWeb is far quicker than anything else that I’ve used.

    So, for me, Scheme has been immediately useful – and I’m presenting the benefits to other groups of developers.

  6. Elias Gabriel Amaral da Silva says:

    Scheme is nice, but for learning FP Haskell is superb.

  7. Very nice writeup, your feelings on the languages you use as well as Ruby reflected mine very well. I was looking for something new to learn and while deciding between Haskell, Scheme and Scala, I’m now probably heading towards Scheme. :)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s