Elements of Clojure
by Zachary Tellman
This book is named, in part, for Strunk and White's classic Elements of Style. Like its namesake, it aims to be short, opinionated, and sometimes wrong. It is intended for readers who are already familiar with Clojure's core concepts, and wish to use them to good effect. Where possible, this book will give concise, prescriptive advice on how to write idiomatic Clojure.
However, many aspects of software defy prescriptive advice. Strunk and White largely concern themselves with the elements of a well-written sentence, but a book is not just a collection of sentences. The same is true for software; the relationships between the expressions matter as much as the expressions themselves. This book addresses these aspects by describing the space of possible approaches, and providing a framework for deciding which to use.
While many of the ideas discussed here are applicable to other languages, a focus on Clojure allows for actionable advice. This book focuses on the JVM implementation of Clojure, for the same reason. Generalizing the advice given here is left as an exercise for the reader.
The first chapter, Names, explains why names define the structure of our software, and provides tools for judging 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 be simplified through separation.
The final chapter, Composition, explores how the constituent pieces of our code can be combined into an effective whole.