I recently acquired a new computer programming book entitled Seven Languages in Seven Weeks (by Bruce A. Tate, published 2010 by the Pragmatic Programmers; ISBN: 978-1-934356-59-3). As the name suggests, this is an introduction to not one but seven different programming languages and is designed to be worked through (it’s very much a hands-on kind of book) in a fairly short space of time. Rather than purporting to provide complete coverage of each language (which would be impossible, probably even for a single one of them, in just one book) it aims to give a fairly general introduction to each one and demonstrate some of it’s particular characteristics, leaving the reader to hit Google in search of further documentation etc. As well as giving you a broad exposure to a range of different programming paradigms, this book is intended to equip you to pick up the elements of a new language quickly and efficiently.
The seven languages covered by the book are (in order of appearance): Ruby, Io, Prolog, Scala, Erlang, Clojure and Haskell. I’ve just started working on the Io section of the book and, if all goes according to plan, I intend to write a blog post about each of the languages once I’ve finished the relevant section. For now, I’ll focus on Ruby.
Of all the languages in the book, Ruby is the only one that I already have a reasonable amount of familiarity with (although I’ve played a bit with Prolog and I’m fairly sure I had a quick look at Haskell once too). I have already written a handful of, admittedly fairly small, real world programs (as opposed to tutorial exercises) in Ruby, which could reasonably be described as a general purpose scripting language. At the moment, I would probably describe it as my second choice go-to language for general purpose programming; Python would be my first choice, largely because I’ve been using it for somewhat longer, am a lot more familiar with it and have a bit more dead-tree-format reference material for it; they are both excellent languages (each with several definite pros and cons relative to the other) and I’d rather get reasonably proficient at both than concentrate exclusively on either one of them.
The particular (though by no means unique) feature of Ruby that Tate focuses on in his book is metaprogramming, which (he says) “means writing programs that write programs”. I’ve come across the idea before, mainly in my studies of Lisp (although I didn’t quite get as far as doing any metaprogramming for myself). I still don’t feel that I entirely grok the concept, but I think it’s definitely something worth exploring further and it appears that Ruby will be a good vehicle for it.
A nice, slightly quirky feature of the book is that Tate likens each programming language to a film (or TV series in one case) character that he feels epitomises similar characteristics. In the case of Ruby, the chosen film is Mary Poppins. Tate describes the titular character (and hence also Ruby) as “sometimes quirky, always beautiful, a little mysterious and absolutely magical.” [Actually, to be pedantic, he applies that description to Ruby and then says “Think Mary Poppins.]
I fairly recently started (or rather restarted, as it’s an old project I started and abandoned several years ago) a programming project using Python, so I’ll probably try to get it finished in that language. However, the next time I have a real-world problem to solve with a script, there’s a good chance I’ll reach for Ruby.