Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp by Peter Norvig
Publisher: Morgan Kaufmann
Back in 2005 I started to publish my book reviews on these pages. My long term goal at that time was "to create lists of recommended reading on different subjects". Since then my collection of reviews has grown substantially even though I don’t review every technical book I read. The ones is publish make-up around every 3rd or 4th book I read. In my published reviews I always try to cover both ends of the awesomeness spectrum; good books are reviewed to provide the recommendations and, perhaps even more important, I write about the occasional, lousy book too in order to save your time and effort for something actually worth it. Just the other day I noticed that I haven't reviewed one of my all time favorites, Paradigms of Artificial Intelligence Programming (PAIP). I decided to immediately restore the order and churn out a review. PAIP is one of the best programming books ever written. It's also considerably broader in scope than its title suggest and a book I always recommend to the ambitious programmer.
PAIP isn't really a book on artificial programming. At least not the kind of AI we've come to expect today. Given that the book is more than two decades old this is actually a good sign. It means that the field has progressed. Instead, the book's sub-title is more descriptive of its content: Case studies in Common Lisp. But it's as a general programming book that PAIP excels, particularly when it comes to coding style. Its style is just great in a way that you rarely experience in a technical book. For example, PAIP stands as a perfect example on the use of comments to augment code. While the code is largely self-documenting and expressive on its own, additional comments are used to communicate trade-offs and overall intent. This style brings the code close to how ideal real-world production code would look, something I don't recall having seen in any other book. Another tremendous strength is Norvig's iterative approach to development. I love how Norvig develops an initial, working version of the program, with some limitations, and then iterativey refines the design and removes the limitations one by one. Usually this process implies a transition from a somewhat imperative style of programming to a more functional style. It's simply beautiful from a pedagogical point of view and refreshing for a reader to take part in the whole thought process that went into the program, not just the polished end-result.
The case studies, as advertised, are drawn from the AI field. PAIP starts out with historic classics like the General Problem Solver and Eliza. After introducing fundamental programming tools like pattern matching and different search algorithms, Norvig takes an interesting step. It's a step that may come natural to a Lisp programmer but probably never even occurs on the radar of more mainstream schooled programmers: grow your programming language to fit the problem at hand! In Lisp, where you have the power of a language designer at your disposal, it's straightforward technique. Norvig illustrates it by developing both a Prolog-inspired logic programming language and an object-oriented language on top of Common Lisp. These extensions are then used to implement other, more capable AI programs. This is programming at a higher level. A level that I'm convinced we need to reach in order to counter the growing complexity of today's software. This style makes PAIP more than an AI book or even just another high-quality Lisp book.
Finally some words on the required background knowledge. Despite the introductory chapters covering the basics of Common Lisp you probably need some working Lisp knowledge in order to appreciate the book. As I read PAIP I'd already worked through some Lisp books and written a set of smaller programs. Once you have that background knowledge, PAIP offers lessons applicable beyond Common Lisp. Sure, some of its practical chapters on efficiency and the reference parts are Lisp-specific. But the bulk of the book is applicable way beyond the specific technology. A good programming style is something you carry with you across language boundaries.
PAIP turned out to be a starting point for me. Back in 2008 I had an e-mail conversation with the late Dan Weinreb. Dan wrote me a long, insightful and friendly mail about my book reviews. As I responded I wrote: "while I love PAIP, it also made me realize how little I know. So, I decided I'll need to build a new foundation for my learning. My solution is SICP by Abelson & Sussman. I have high expectations on it." It turned out those high expectations were widely exceeded; SICP remains my favorite programming book. PAIP comes in at a close second place and it's a book I recommend to anyone. Just make sure you have a understanding of Lisp's basics and you're in for a pleasant and rewarding learning experience.
Reviewed September 2013