Structure and Interpretation of Computer Programs: JavaScript Edition
Harold Abelson, Gerald Jay Sussman, Julie Sussman, Martin Henz, Tobias Wrigstad
Here is the dedication of Structure and Interpretation of Computer Programs: JavaScript Edition
This book is dedicated, in respect and admiration, to the spirit that lives in the computer.
Now, perhaps it is narrow-minded of me, but I am of the opinion that a book so dedicated and so titled ought to have something to do with real computers. My main problem with SICP (AKA "The Wizard Book") is that it doesn't. OK, that is unfair, but only slightly. I will explain.
I taught myself to program starting in 1973. A month or two after I began I was totally baffled by a bug in a simple program I wrote to do a mathematical task. The nature of the bug became clear to me only when I developed a clearer picture (vague and rudimentary at that stage of my education) of what was happening physically inside the computer when it ran my code. Once I had that concrete picture the nature of my problem became so clear to me that it was hard to understand why I had ever thought my original code would work.
SICP is based on the entry-level computer science course taught by the authors (Harold Abelson and Gerald Jay Sussman) at MIT (Massachusetts Institute of Technology) from 1980-1997. This course was so highly thought of by computer scientists that it mutated and metastasized to other universities, notably the National University of Singapore (NUS), where this JavaScript mutant version came into being (adapted from the original Scheme-based version by Martin Henz and Tobias Wrigstad).
In SICP computer programs are discussed as abstract processes. The authors describe how to build a program as a series of layers of abstraction from the highest level of description to lower levels. Implicitly they admit that somewhere, if you go far enough, the rubber has to meet the road -- the program has to describe things that happen at the bare metal level. But they never go down there. Even the final chapter, chapter 5, "Computing with Register Machines", deals only with an abstract machine.
Now, let me be clear -- abstraction is essential in programming -- and there is a lot of value in SICP. No one disputes that. But I contend that some understanding of what happens at bare metal is also essential.
This all ties into the choice of a programming language, about which I feel compelled to spend a few paragraphs. (Feel free to skip.) The original SICP used Scheme, a dialect of LISP. It is obvious from the defensiveness of SICP that even Abelson and Sussman recognized that could be a controversial choice. There are, throughout the front matter and early chapters of SICP, many paragraphs that feel like they ought to be introduced with "And now, a Word from our Sponsors" about how LISP and LISP data structures are the ideal way to program. In later chapters the authors make numerous snide remarks about C, probably the dominant programming language of that time. For instance, one exercise introduces the character "Cy D. Fect, a reformed C programmer", and C is elsewhere described as a low-level language.
This JavaScript edition is a sort of partial acknowledgement of the reality that Scheme was not destined to become the dominant programming language. However, it would be a bad mistake to think that SICP is going to teach you to program in JavaScript. In their Preface, Henz and Wrigstad admit
The book covers just a small fraction of JavaScript, so a reader would be ill-advised to use it to learn the language. For example, the notion of a JavaScript object—considered one of its fundamental ingredients by any measure—is not even mentioned!
It was straightforward to translate the programs of chapters 1–3 to JavaScript by adding libraries that mirror Scheme primitives
Thus in chapter 2 we are introduced to data object pair, which is -- let us not play dumb -- a Scheme CONS. The main value of the JS version is that it is available on the web from Source Academy, with runnable versions of all code and exercises embedded.
One big difference, to my mind, between JavaScript and Scheme on the one hand and C on the other, is that C was designed by people who know very well how real physical computers work (this, by the way, is also true of Abelson and Sussman) and who deliberately designed a programming language to reflect and not hide physical reality (this, emphatically, is NOT true of Abelson and Sussman).
Abelson and Sussman are defensive because, in one important sense, Scheme lost the war. The sense I speak of is popularity, or breadth of acceptance. If you wish to earn a living as a programmer, familiarity with C and its successor C++ is virtually a necessity. In contrast, if the only language you feel comfortable with is Scheme, your employment opportunities will be limited. Now I don't claim that popularity is necessarily a measure of merit in any global or artistic sense. But it is not something you can afford to ignore if you intend to work with other people.
In fact, MIT stopped teaching SICP. In a video you can find by searching for "SICP: the end of an era" Sussman admits that Scheme lost the war in the sense I just described, and that other languages are now more practical. Not C -- he could never stoop so low -- but python, at least.
SICP was one of those books that evoked the dreaded "Thank God that's over!" feeling on completion. I would not recommend it to anyone.


