Book Reviews
Loving Common Lisp, or the Savvy Programmer's Secret Weapon by Mark Watson
Publisher:
Leanpub
Pages:
119
A programmer approaching Common Lisp from an OO background is in for a challenge. I know, since I've made that transition myself. But it's a challenge well worth the effort; learning a high-level multi-paradigm language like Common Lisp will change the way you look at programming for the better. To ease the task, a Common Lisp newcomer is lucky to have several high-quality books available. My personal favorite is Practical Common Lisp. Once you've worked through that one, the Lisp field is rich with exceptional books on more advanced aspects of the language (PAIP, SICP and LoL are all highly recommended). All these books focus on the core language. What I've been missing is a hands-on approach to real, large-scale development. Such an approach would necessarily include the usage and application of the powerful open-source libraries available to Common Lisp programmers. Loving Common Lisp is a step in that direction.
The challenge of using a library is to strike the right balance between expressiveness and programmer efficiency. A generic library is by necessity poor on context. It's a good thing, but puts the responsibility on the application programmer to raise the abstraction ladder. In many cases it's as simple as the battle-proven extra level of indirection to express the program in terms of the application rather than the generic library. It's a question of intent versus mechanism, of what rather than how, with the goal of writing programs that communicate well. To me, this aspect is the hardest part of software development. To an author it presents the challenge of communicating that style since much of it is about expertise, experience and taste. While Loving Common Lisp succeeds at introducing powerful open-source libraries, it could do better at the communication aspect.
Much of the code in this book evolves around library calls. Sure, Mark usually builds an application level API. But it's a thin wrapper. I'd personally rather see a multi-layered approach where the language is built-up and extended to the level of the application. This brings me to the point of my second criticism. Taking such an approach would lead to a natural, iterative style to which Lisp is so well-suited. As it stands now, the book often presents code chunks up-front and discusses them afterwards. I'd suggest that the author reverses this process to mirror an evolutionary style of programming instead. To give a concrete example, consider the chapter on using distributed databases. The chapter itself is a good overview of how we integrate different database services with Common Lisp. In the chapter on MongoDB, the author uses the cl-mongo library to create and populate a document. There sure is some boiler plate code in there. Why not take that opportunity and show the unique strength of Lisp by introducing a with-document macro? After all, the ability to remove all signs of subtle duplication is why I love Lisp.
So far, this review probably sounds more negative than I intend it to be. Loving Common Lisp is a useful book written by an enthusiastic and experienced programmer. It's filled with personal experience and serves as a useful introduction to several high-quality libraries. The covered problem domains are interesting too. I particularly liked the chapter on Natural Language Processing, although the writing is probably too dense to serve as an introduction to the subject. It's always useful to read larger programs, particularly when starting out with a new technology. It allows the programmer to get a feel for the organization and structure of non-trivial programs. Loving Common Lisp is a book I wish I'd read as I started out with Lisp back in 2005. The scope of the book has a lot of potential. I just can't help to think it could have been developed and refined even further.
Reviewed November 2013