Seven Languages in Seven Weeks

If you are a programmer, you are probably too busy to read books about programming, especially those that are not directly job-related. But if you have time to read at least one such book this year, you will not make a mistake if you pick Seven Languages in Seven Weeks by Bruce A. Tate, published by The Pragmatic Bookshelf.

This book is a drive-by introduction to the following seven programming languages: Ruby, Io, Prolog, Scala, Erlang, Clojure, Haskell (in this order). If you’re like me and your entire programming career has been in a “classical” object-oriented programming language like Java or C#, then these languages are ones you may have heard of, but don’t really have a clear idea what they’re all about. This book will change that. But it is not a textbook and it will not turn you into a proficient user of either of the seven language. It reads more like a novel with code examples. For each language, it shows you its main typological properties and explains how it’s different from others. Each chapter even includes a mini-interview with a person who knows the language well, often the language’s creator himself (yes, himself: sadly, it seems that programming language design is a man-only affair).

A book like this could not have been published at a more opportune time. Maybe it’s just me, but it seems that people have become more willing to experiment with new programming languages and paradigms recently. Some of it is probably driven by new needs, such as the need to develop web applications more quickly. This has given us so-called agile languages such as Ruby. But perhaps people are just getting bored with the classical object-oriented paradigm which has been with us for about two decades and does not feel like a novelty any more. That’s probably why we are now seeing more of functional programming languages such as Haskell re-emerging from academic obscurity and having a go at the mainstream. Even Microsoft, the IT industry’s bastion of conservatism (never mind IBM), has recently created its own functional language, F#.

The nice thing about functional programming is that you don’t actually have to learn a new programming language to do it. You can start using some functional techniques in your existing language of choice straight away, because functional programming is mainly about discipline. An important principle is: instead of passing computed values between objects, pass functions that will compute the values later. This is something you can do in any language that supports anonymous functions. For me, reading about functional programming has been the most important takeaway from this book, mainly because I had had some (less gratifying and more frustrating) encounters with it before.

Another valuable takeaway I got from the book is a deeper insight into how typing works in different programming languages. Having read about duck typing in Ruby, I finally understand why types in JavaScript behave as strangely as they do.

But my most favourite chapter is probably the one about Prolog, a declarative language in which you find answers to questions by describing the conditions the answer must fulfil and then letting the computer figure out how to get there. I have had a long and slightly troubled relationship with Prolog. It was one of the first programming languages I ever learned, back when I was a bespectacled teenager, and I have always had a reverent admiration for the quiet elegance of the declarative programming paradigm. The only problem is that I have never had a chance to use declarative programming for any practical purpose in my career (except for trivial implementations such as XSL transformations). I suspect a lot of programmers will have a similar story to tell about Prolog. So Prolog remains more of a toy and less of a tool for many of us, but what a magnificent toy it is!

It says in the book’s blurb that you should learn a new programming language each year. I wish I could do that, so instead of churning out one half-baked application after another as quickly as possible, I could concentrate more on programming for fun and elegance. Maybe I’ll get to it when I retire. Until then, a drive-by introduction like Seven Languages in Seven Weeks will have to do.


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