Delving into Computer Science with SICP
The Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman is often cited by experienced developers as one of the books that fundamentally changed the way they think about computer science and software development.
SICP is also a somewhat intimidating tome that demands a fair bit of perseverance and dedication from its reader. Like most things in life of course, things worth doing typically take time and effort!
Why study sicp?
I suspect many developers today would see learning a language like Scheme as anachronistic, and potentially less than practical. Interestingly, there seems to have been a recent resurgence of interest in functional programming.
Chris Hanson posted the following on StackOverflow in response to a user enquiring about the value of working through SICP:
Even if you don’t do the exercises, it’s worth reading through Structure and Interpretation of Computer Programs at least once. Unlike The Art of Computer Programming it’s written not to appease some bizarre notion of machine architecture but to demonstrate the fundamentals of computational processes, and it excels at that.
Some of what you’ll learn simply by reading through SICP:
- Functional decomposition and modeling problems
- Recursion, its uses, pros and cons
- Imperative and functional programming
- Control structures, and why they have the behavior they do
- Language design
- Computer architecture
- Compiler implementation.
The compiler implementation bits later on in the book will be especially enlightening to many working software developers, who if they haven’t had a class on the topic often think compilers are strange and mysterious beasts and that creating languages is “hard.”
My feeling is that a lot of people suggest reading The Art of Computer Programming because having waded through it makes you feel smart, but that people suggest reading Structure and Interpretation of Computer Programming because it clearly presents knowledge every software developer needs a thorough command of.
I won’t be alone in my journey - a number of others have blogged about their experience as they’ve worked through the book and the course material. Both Bill the Lizard and Eli Bendersky have some excellent posts both on the content of the lectures and working through the exercises.
Lecture Videos Also provided from the OCW site, but this page provides links to torrents.
Selecting a Scheme interpreter
There are an astounding number of Scheme implementations available today, and to the beginner this can be somewhat overwhelming. The Community Scheme Wiki has the following advice regarding choosing an implementation for learning Scheme:
Beginners should select an implementation that is well-documented, adheres closely to the standard, has good error handling and debugging capabilities, is easy to install, is mature, stable and under active development. Chez Scheme, Gambit, MIT Scheme and PLT Scheme are all used extensively in teaching Computer Science courses and hence meet all the aforementioned requirements. Chicken, Bigloo, EdScheme, OpenScheme, Scheme48, and SCM are quite beginner-friendly too.
I’ve decided to give Chicken a go, primarily because I find the name amusing, but also as it has POSIX support and provides both an interpreter and compiler. A fair bit of real world development appears to be done with Chicken, so there would be no need to switch implementations if I decided to start building apps in Scheme one day.
Setting up a Scheme environment in Mac OS X
Installing Chicken is a snap if you have Mac Ports installed - simply run:
sudo port install chicken
If you don’t have Mac Ports installed, the latest release is available from the Chicken website. You’ll need to have installed XCode to build Chicken from source.
Choosing a text editor
If you use TextMate, you’ll find the Scheme bundle helpful as it provides syntax hi-lighting and bindings for your Scheme interpreter such as ⌘R for Run Script. To install the bundle, run the following commands in Terminal:
mkdir /Library/Application\ Support/TextMate/Bundles/
svn co http://svn.textmate.org/trunk/Bundles/Scheme.tmbundle/
osascript -e 'tell app "TextMate" to reload bundles'
Any text editor that you’re comfortable with will be fine, but you’ll probably find life easier if you select one with some form of syntax hi-lighting and parenthesis matching for LISP/Scheme.
PLT Scheme provides a Scheme IDE called DrScheme, which runs on Windows, Linux and OS X.
Emacs is another popular option in the LISP/Scheme community, and available in many guises. Aquamacs is a good aqua interpretation for Mac OS X.
blog comments powered by Disqus