cat parenthesis I gave a presentation at Barcamp Orlando a couple of months back, about some of the lesser known, but more advanced features of Javascript. Most of these features stem from the fact that javascript is a functional language. Functional Programming Languages, such as LISP, Haskell, Erglang, and many others, have some very significant differences than most imperative programming languages. Based on my limited experience these are what I see to be the most important differences:
Functional Imperative
Objects 1 are immutable. You cannot change them, only transform and return a new value Object's values can be changed (mutable).
Functions are first class objects (Higher Order Functions) which is just a fancy way of saying that you can pass and return functions to other functions. Functions are a semantic construct that only the language compiler can access.
Loops are implemented using recursion2, which means a function will repeatedly call itself from inside its function definition until some final condition is met. Loops are implemented with special looping syntactical constructs, such as for, while, foreach.
Coding Style: You don't "tell" the language what to do, you "describe" what you are doing by combining functions into a concise readable format. Coding Style: You "tell" the language what to do in a series of steps.

This is anything but an exhaustive comparison between traditional functional and imperative programming languages. I did purposely list these 4 because I think they are the largest factors in why I am starting to feel that functional programming is going to take off. The interesting aspect of that last statement is that functional programming languages have been around since forever (LISP was originally specified in 1958), but most developers continue to use imperative languages. I think one reason for this disparity is the more advanced IDE support for imperative languages, and the idea of the IDE Gap which hypothesizes:

The developer world is divided into two camps. Language mavens wax rhapsodic about the power of higher-level programming — first-class functions, staged programming, AOP, MOPs, and reflection. Tool mavens are skilled at the use of integrated build and debug tools, integrated documentation, code completion, refactoring, and code comprehension. Language mavens tend to use a text editor such as emacs or vim — these editors are more likely to work for new languages. Tool mavens tend to use IDEs such as Visual Studio, Eclipse, or IntelliJ, that integrate a variety of development tools1.

What Oliver Steele lays out is a convincing argument why there seems to be two radically different programmer camps, the Language Mavens vs the Tool Mavens. If you follow his argument (and agree with it) its easy to see why more casual developers 3 tend to work in Imperative Languages while more advanced programmers work in Functional Languages. Of course these are just generalizations and there are plenty of great/casual developers on both sides, but the distribution seems to hold.

If you keep following this thread it starts to make sense why more software companies/vendors/consultants are firmly in Imperative land, while significantly fewer work in Functional world. The Long Tail of the programmer distribution are Functional Programmers, while the head are Imperative (how many Java/C# programmers do you know? How many Haskell?)

For all these reasons I have started to teach myself LISP, one of the first, and some would say the most powerful, functional language. I have started to take the OpenCourseWare course Structure and Interpretation of Computer Programs. Even though popular book on Common LISP has been published recently, I decided to take this approach instead for a couple of reasons:

  1. I want not only to learn how to program in LISP, I also want to learn the theory behind its spec.
  2. I want to force myself to tackle hard problems, which there are a plenty in the projects section.
  3. I want to experience what its like to learn LISP the same way MIT students do.
  4. It gives structure to the learning process.
  5. There are awesome lecture notes.
  6. There is also an iTunes U UC Berkely offering for the same class.
  7. I wanted to challenge myself.

And so I begin the long process of learning a new programming language (and paradigm). I will be creating a post for each project (there are 5) in the SICP course after I finish it along with the code. So if you would like to take the journey into unchartered paranthesis land with me, please, be my guest. I have just started the first project, so expect a post soon.

1Object not in the sense of an Object that exists in an Object Oriented language.

2Some imperative languages allow for recursion, but they are not a prominent part of the "culture", if that makes any sense.

3I am defining a Casual Developer as someone who views programming as an ends to a living, not a valuable endeavor on its own.

Cat picture : http://www.flickr.com/photos/judahm/360923475/

1 Response to “Functional Programmers are the Long Tail (or why Im learning LISP)”

  1. Jon Harrop Says:
    You might like to learn some of the more modern statically typed functional programming languages like OCaml, F# and Haskell. They offer many advantages over Lisp for professional programming.

Sorry, comments are closed for this article.