Rediscovering Dr. Dijkstra and Giving LISP a Second Chance

It’s strange and interesting how I got to this point. I’ve been working as an ASP.Net (web) and MFC (GUI) developer. Some months ago I got a job referral from a friend. Someone needed a developer for an internet search engine they were working on, and they were looking for someone who knew Lisp, among other things. I hadn’t programmed in Lisp since college (1990), and even then I grew to hate it because the materials I was given to learn it were not good, and the teacher was bad to boot. Lisp was very foreign to me, but then I wasn’t taught what a functional programming language was (vs. an imperative one like Pascal, C, etc.). I learned that a few years later in a more advanced course. Anyway, the “help wanted” ad was intriguing. I didn’t go for the job, because I just wasn’t qualified for it.

A month or two ago Paul Murphy, a blogger at ZDNet, posted an article about Dr. Edsgar Dijkstra and how he had criticized APL. Dr. Dijkstra was frequently cited in my computer science textbooks in college. I got into an interesting discussion with folks in the Talkback section of Murphy’s article, and got curious, “What was Dijkstra’s favorite programming language?” I did a Google search and found out he didn’t have one. He didn’t even have a computer at home! Interesting. Incidently, Dr. Dijkstra died in 2002.

Along the way though I found several blog entries criticizing Java, but all had something nice to say about Lisp. I also read Paul Graham’s article on Lisp (he’s a BIG Lisp booster). He emphasized that every programmer should learn Lisp, even if you don’t end up using it. It makes you a better programmer. I was impressed with Graham’s account of ViaWeb (now Yahoo! Store), a web application he and some business partners created during the 1990s which allowed customers to build their own e-commerce sites. It was completely written in Lisp. Graham said that Lisp is simple and powerful, two words I like very much, which enabled him to stay a few steps ahead of his competition when developing ViaWeb. He also pointed out that there are airline reservation systems in use today that are partly written in Lisp. The major point he made is that Lisp is a good general-purpose programming language. It’s not just for AI or language processing projects. I got inspired. I’ve decided to give Lisp a second chance.

I got CLISP, an open source implementation of ANSI Common Lisp, and I followed the included introductory tutorial (in the doc directory of the installation). It’s much better than what I was given to learn Lisp in college. Just for the heck of it I’ve been working on a couple Lisp programming problems I was not able to completely solve in college, as an exercise in learning it. It’s been challenging and fun. I also discovered there’s an open source Lisp implementation for .Net, called DotLisp. I’ve thought a bit about programming problems I’ve had to solve on recent projects, and I’ve wondered whether using Lisp in .Net might’ve made them easier to implement. The only thing is my boss probably wouldn’t have liked me using it, since most programmers don’t know Lisp well, if at all. Using a minority language can render your code non-maintainable for all intents and purposes, no matter how well written it is in the language.

Recently I read a few comments on Lisp, saying that while it’s a good language, it’s not necessarily the best one for real world projects. Apparently tool and library support are lacking for it, so developers are likely to be on their own with it unless they’re doing nothing more than implementing some algorithms, or doing something which happens to have library support. A few suggested Python as a substitute, since it’s popular and has many Lisp-like qualities. Perhaps Ruby (or Ruby on Rails) would substitute as well? I’ve heard Ruby on Rails is similar to Scheme, a Lisp variant. Even so, it would be neat to try mixing in some Lisp into a mostly C# project to see if it helps in solving vexing problems, beyond the typical CRUD (Create, Read, Update, Delete from a database) operations.

I found LispDoc, a small web page with excellent links to documentation sources for Common Lisp.

I’ll close with a speech of Dijkstra’s that I thought was funny because it was just so blunt: “How do we tell truths that might hurt?”, from 1975.

Edit 9/15/06: One might call his speech, “How do we tell truths that might hurt?”, “An Inconvenient Truth” for the discipline of computer science. 🙂

Edit 9/27/06: I finally found a quote I was looking for by Philip Greenspun on Lisp here:

Greenspun’s Tenth Rule:

“Any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp.”

Here are a couple more quotes on it (from the same source) from computer science luminaries:

“the greatest single programming language ever designed”
     – Alan Kay

“Lisp has jokingly been called ‘the most intelligent way to misuse a computer’. I think that description is a great compliment because it transmits the full flavor of liberation: it has assisted a number of our most gifted fellow humans in thinking previously impossible thoughts.”
     – Edsger Dijkstra, CACM, 15:10

Advertisements

9 thoughts on “Rediscovering Dr. Dijkstra and Giving LISP a Second Chance

  1. Pingback: Exploring Squeak and Seaside « Tekkie

  2. Have you checked into Haskell? It’s a Functional Programming language like LISP, but with an (IMHO) much syntax and semantics. I learned both LISP and Haskell in college, and I find LISP to be a bit overblown in terms of the amount of code it takes to create a function compared to Haskell, and much easier to read if you’re used to reading mathematical definitions of functions. It’ OSS and multi-platform, so I’d definitely give it a whirl.

  3. Probably it isn’t a random thing… It happened to me also, to rediscover Dr. Dijkstra and Lisp. I am still learning Common Lisp and I havn’t really done anything with it, so I still don’t know if the appreciation that’s given to it from quite some people is right.

    One thing: stating what Graham writes, one of the most distinctive characteristics of Lisp (CL) are the macros; he has even wrote a book about it (“On Lisp”). He also appreciate Lisp because it’s well suited for a bottom up programming style.

    Another thing, about Dijkstra: I can tell that he liked Algol 60… At least he liked its definition, since it was the first one using the Bakus Naur Form, if I remember well. Anyway he always looked for a minimalistic language and in his code (the one that I’ve read) he always uses a subset of Algol (or Pascal, for what I can tell… I’m too young ;-); anyway, I can surely tell that whatever language, Dijkstra had a big thing for axiomatic formal methods, applied to imperative programming.

  4. @blasnoff:

    Yeah, maybe it wasn’t random, but just a phase of intellectual development. I still find it interesting though that I just fell into this. After my experience in college with Lisp I was sure I had sworn it off forever. Nowadays I focus mostly on Smalltalk and Squeak, but my interest in these things is in the same vein as when I started learning Lisp again.

    There were a couple things that came together to make this possible for me: the internet, and computing power. I don’t think I’d ever have gotten back into it if it weren’t for the internet. There’s so much on it that enables you to get the tools and learn how to program with them.

    It’s only been in the last several years that languages like Lisp, Smalltalk, Ruby, etc. have become viable on affordable computers.

    I’m seeing the same thing you are. I haven’t been using Squeak much lately either. I’m focusing more on learning software design principles, which are evoked by the design of the Smalltalk language. One of the things Alan Kay has said is that software architecture is more important than the technology you use, though using tools that best enable that architecture really helps. The real benefits come from changing the way you think, not what technology you use. If you program in Lisp the same way you program in C# or Java, you’re not going to get much benefit out of it.

    I didn’t know Dijkstra liked Algol so much. I know he wrote the first Algol compiler. He won his Turing Award for that work, as I remember. It was the first to use BNF. One of those guys, Backus or Naur (maybe both?) worked on developing the Algol language spec. It looks like Dijkstra liked Pascal as well, which was heavily influenced by Algol, with some reservations. I was going to suggest he would’ve liked C as well, since it had a similar syntax to Algol, but I don’t think he would’ve liked its emphasis on pointers. Like I said, he liked Lisp, so he wasn’t so fixated on just Algol. I know he didn’t like OOP, at least as it’s been popularly implemented. I’d be curious to know what he thought of Smalltalk, since it uses what Kay would prefer to call “Message-Oriented Programming” (he considers his invention of the term “Object-Oriented Programming” as a mistake).

    From my research on Dijkstra he had a big thing for writing programs that were provably correct. In one speech I read he said that in his introductory courses the students made up their own language, using mathematical/logical principles. He didn’t want them using languages that already existed, for fear that students would want to test their programs. He wanted to avoid the “program and test” mentality. Since programs could and should be proven correct, that’s all that was needed, in his opinion. What CS has shown is there is useful and essential software that cannot be proven correct, at least using the notation and design notions we currently have. CS has taken the position that this state of affairs is okay. Others have as well, like Alan Kay,and those who use Lisp. They say, “We don’t know how to write software systems yet,” and our development tools should acknowledge that.

    One of Dijkstra’s ideas that I really liked was that it’s the job of computers to execute our ideas. We should not have to figure out how to make them do that. The computer should come to us, not us to it. Alan Kay had similar ideas, which is the reason why we’re using GUIs today.

  5. Dijkstra did not like Lisp, his compliments about Lisp are always insults hidden tongue in cheek. If you read his articles you will find mostly he bashes Lisp for its poor specifications, poor manuals, lack of clear direction, and its ridiculous artificial intelligence aims which he was heavily against.

  6. [This excerpt is from “Computing Science: Achievements and challenges”, by Edsger Dijkstra. — Mark Miller]

    “It is a pity that they were called Programming Languages, but apart from that unfortunate name, FORTRAN and LISP have been the great contribution of the 50s.

    That name was unfortunate because very soon the analogy with natural languages became more misleading than illuminating. It strengthened the school of thought that tried to view programming primarily as a communication problem, it invited the psychologists in, who had nothing to contribute, and it seriously delayed the recognition of the benefits of viewing programs as formulae to be derived. It was the time of Edmund C. Berkeley’s “Giant Brains or Machines that Think”, it was the time of rampant anthropomorphism that would lead to the false hope of solving the programming problem by the verbosity of COBOL and would seduce Grace M. Hopper to write a paper titled “The Education of a Computer”. Regrettably and amazingly, the habit lingers on: it is quite easy to infuriate computing scientists by pointing out that anthropomorphizing inanimate objects is in science a symptom of professional immaturity.

    As said, FORTRAN and LISP were the two great achievements of the 50s. Compared with FORTRAN, LISP embodied a much greater leap of imagination. Conceptually FORTRAN remained on familiar grounds in the sense that its purpose was to aid the mechanization of computational processes we used to do with pen and paper (and mechanical desk calculators if you could afford them). This was in strong contrast to LISP whose purpose was to enable the execution of processes that no one would dream of performing with pen and paper.

    At the time LISP’s radical novelties were for instance recognized by its characterization as “the most intelligent way of misusing a computer”, in retrospect we see its radical novelty because it was what is now known as a language for “functional programming”, while now, 40 years later, functional programming is still considered in many CS departments as something much too fancy, too sophisticated to be taught to undergraduates. LISP had its serious shortcomings: what became known as “shallow binding” (and created a hacker’s paradise) was an ordinary design mistake; also its promotion of the idea that a programming language should be able to formulate its own interpreter (which then could be used as the language’s definition) has caused a lot of confusion because the incestuous idea of self-definition was fundamentally flawed.”

  7. Pingback: Does computer science have a future? « Tekkie

  8. Pingback: The 150th post « Tekkie

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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