Tools

Jolt Awards: The Best Books

Jolt Finalist: The Joy of Clojure: Thinking the Clojure Way, by Michael Fogus and Chris Houser

I consider myself more of a Scala person than a Clojure person, but this book persuaded me to become an even bigger fan of Clojure, the new Lisp-like language that runs on the JVM. Authors Michael Fogus and Chris Houser, both contributing members to the Clojure language project, have crafted a Clojure book unlike any other Clojure title I have read. Rather than pursue the plain path of a language reference, The Joy of Clojure examines the language from a deeper perspective. As such, it expands the reader's thinking with the possibilities (and some limitations) that the current 1.2 release has to offer.

The book is delivered in five parts. The first, Foundations, covers the Clojure philosophy and sets the stage of the tone and topics to come. The basic constructs like scalars, collections, functions, vars, loops, blocks, quoting, exceptions, and namespaces are also discussed. Part II, Data Types, goes deeper into understanding how to best utilize scalars and composite data types in Clojure by considering symbolic resolution, regular expressions, persistence, complexity, queues, and sequential evaluations. Part III explores the hot topic of functional programming, a category that Clojure excels and made its name in. While only two chapters long, the working lazy quick sort and pathfinding examples do the job of showcasing Clojure's power in the functional programming space.

Part IV features another top strength of Clojure: large-scale design. This scaling need is truly why languages like Scala and Clojure exist, and the authors do an excellent job of distilling their knowledge of the subject into four chapters. This section is also the heart of the book and covers the use of macros to control, combine and change forms and manage resources, using the "Universal Design Pattern" with Clojure's multimethods and the Java-Clojure. Chapter 11 on Mutation is a must-read, filled with best practices on the use of agents, atoms, futures, locks, promises, refs, vars and dynamic binding. There's a lot to digest in this chapter and will prove invaluable toward advancing your Clojure experience.

The last part of the book, titled Tangential Considerations, contains chapters on performance issues (type hints, transients, chunking, memoization, and coercion) and a final catch-all chapter on the design considerations behind DSL's, testing, design patterns, error handling, and debugging. It's hard to believe that Fogus and Houser were able to pack so much excellent advice into a 350+ page book.

Readers unfamiliar with the mechanics of the language should first read the other basic tutorial Clojure books on the market, play with the language, and port a few simple programs to it before checking out this book. And while the book's Web page assures that no Lisp experience is necessary, I disagree. Readers who will get the most out of the book and Clojure itself need to have some awareness of Lisp due to Clojure's reliance on that language's main principles. So while it may not be necessary to have Lisp experience, the philosophy and principles expounded upon in The Joy of Clojure will take Lisp (and other functional programming-aware developers) readers further and resonate more deeply with this background experience at the ready.

Additionally, while the book can certainly provide insights to the first-time Clojure student, it will be best appreciated by those who have gained some appreciation for (and frustration with) using the language. It is a book crafted for intermediate Clojure developers seeking to hone their skills and reveal the more graceful subtleties the language has to offer. So while I am still likely to remain a Scala user by day, reading this book has made me a Clojure convert by night.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!