Elements of Clojure

by Zachary Tellman

This book was conceived as "the best second book to read about Clojure". Along the way, it became an exploration of why software design is an intractable problem.

These are not as unrelated as they may seem. Beginners can easily learn all the things that Clojure makes possible, but when they try to build something, they often get tangled up in their own indecision. There are countless paths to their goal, and no way to tell which one is "right".

Some questions can be answered without any understanding of the problem that is being solved. These sorts of answers are often found in style guides. For everything else, a book can only offer concepts and methods that the reader, using their domain expertise, can apply to the problem at hand. But this will not reveal a single, optimal approach.

In Notes on the Synthesis of Form, Christopher Alexander observes that there is no obvious definition for "good fit" other than the absence of "bad fit". There is no right approach to a design problem, but there are many wrong approaches. Towards this end, Elements of Clojure explores the many ways that our software can fail to be useful.

Some of these are specific to Clojure, but most are not. Readers who have no particular interest in Clojure, but want a better framework for judging names and abstractions, may still find this book valuable.

The first chapter, Names, explains why names define the structure of our software, and how to judge whether a name is any good.

The second chapter, Idioms, provides specific, syntactic advice for writing Clojure which is clean and readable.

The third chapter, Indirection, looks at how code can made simpler and more robust through separation.

The final chapter, Composition, explores how the constituent pieces of our code can be combined into an effective whole.