17 November 2014

Old programs

These remarks are my contribution to a keynote address by Eliza Brock Marcum at Nodevember, a JavaScript and Node.js conference in Nashville, Tennessee. Eliza’s talk was on history and the value of history in computing.

I’m always delighted by the light touch and stillness of early programming languages. Not much text; a lot gets done.

—Richard Gabriel, “50 in 50”

Old programming books are better on average than new ones.

Today there are a lot of meh programming books bringing down the average. Hastily written, barely edited, extravagantly typeset, quickly obsolete. Not bad, exactly, but not outstanding. Maybe you’ve written one!

The books we need aren’t necessarily being written. Fortunately a lot of them were written 30 years ago and they’re still good.

I’m going to drop a couple of examples here, but please take these as a literally random sample, not particular recommendations.

I was recently given this copy of Programming Pearls by Jon Bentley. He wrote for the ACM’s magazine before the ACM turned evil, and this is a collection of his columns. It was just one a big box of old programming books, but it stood out because it has some of the worst cover art I have ever encountered. I figured it had to be the content that was good.

And it’s good. I challenge you to name a programming book with as much sheer joy in its pages as there is in the first twenty pages of this book. There’s this one page with three programs written in three different languages that work together to solve a problem because that’s the Unix way. The right way.


    #define WORDMAX 101
    {   char thisword[WORDMAX], sig[WORDMAX];
        while (scanf("%s", thisword) != EOF) {
            strcpy(sig, thisword);
            qsort(sig, strlen(sig), 1, compchar);
            printf("%s %s\n", sig, thisword);


    $1 != prev  { prev = $1; if (NR > 1) printf "\n" }
                { printf "%s ", $2 }
    END         { printf "\n" }


    sign <dictionary | sort | squash >gramlist

Publication date: 1986. These programs still run today.

This month I opened a book that was written in 1977 and unexpectedly found the annotated source code of an operating system in it. It’s chapter 5. Seventy pages of a slim, 300-page book that isn’t even about operating systems. It’s Architecture of Concurrent Programs by Per Brinch Hansen.

It says that the whole operating system, including some parts that aren’t in the book, is five thousand lines of code. It was written by a team of two.

Imagine understanding a whole operating system.

(In fact later I found out this book contains listings from four different small operating systems. It also contains a summary of the book in Danish.)

These old books are a delight to read. The programs in them are a delight to read. There is beauty and poetry in them. This will sound trite, but they were written in a simpler world. They really were. Programming was simpler. There was no client/server divide. No HTTP, no URLs, no network, no browser, no events, no queues, no GUI. There was no concept of your data living in some other database process. You always had your hands on the data directly. These programs have a clarity and simplicity and immediacy that is strange to us now. But I can’t shake the feeling this is what we need to be striving for.

If you haven’t experienced it, you can’t strive for it. You’re designing the platform we’re all going to be using tomorrow.

Read yesterday’s programs. We’ll all be better off.

The past is a foreign country: they do things differently there.

—L. P. Hartley

There is another reason to dip into the past. Travel is broadening.

Programming was once younger, and people had crazy ideas. Ideas that were uncontaminated by practice, formed by brains that weren’t ground down by hard experience.

One out of every thousand crazy ideas you hear is going to change your life.

Take functional programming. The first major functional programming language was APL, implemented in 1963. It looked like this (example from Wikipedia):

life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}

And when did the golden age of functional programming begin? It was last Tuesday actually. Yeah. We need it today.

Seven years ago I remember sitting in an ECMAScript standard committee meeting, thinking we can’t expect JS programmers to understand closures and lexical scoping. I have never been more wrong in my life. FP is here to stay (with slighty different syntax, as it turns out). It only took 50 years to catch on.

The operating system I was telling you about earlier? That was never a commercial product. As far as I can tell it never went anywhere. And yet.

That book is full of ideas that make me think of Erlang (but it was written 9 years before Erlang) and even more so, Rust (but it was 25 years before Rust).

It makes me want to build new things.

No comments: