Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Clojure for Domain-specific Languages Paperback – December 18, 2013
|New from||Used from|
All Books, All the Time
Read author interviews, book reviews, editors picks, and more at the Amazon Book Review. Read it now
About the Author
Ryan D. Kelker
Ryan D. Kelker is a Clojure enthusiast and works as a freelancehe is willing to take on any project that sounds interesting. He started exploring computers and the Internet at a very early age and he eventually ended up building both machines and software. Starting with MS DOS, batch files, and QBasic, he eventually floated towards Arch Linux and the Clojure language.
He has four certifications from both CompTIA and Cisco, and has decided not to pursue any additional certifications. These days, he spend most of his time reading about software development, cyber security, and news surrounding up-and-coming computer languages. While away from the computer, he is usually reading a book or going out to eat with the people he loves the most.
If you buy a new print edition of this book (or purchased one in the past), you can buy the Kindle edition for only $2.99 (Save 91%). Print edition purchase must be sold by Amazon. Learn more.
For thousands of qualifying books, your past, present, and future print-edition purchases now lets you buy the Kindle edition for $2.99 or less. (Textbooks available for $9.99 or less.)
Top customer reviews
DSLs, and yet it's a hard topic get into. A good book on the subject
is just what the Clojure ecosystem needs.
Sadly, this isn't that book.
The biggest problem is that there's hardly any content about writing
DSLs. This is a ~240 page book, and about 200 of that is just "Intro
to Clojure" stuff. That would be fine, but there are much better
introductory books out there.
Filler aside, that leaves maybe 40 pages that are actually about writing
DSLs. Sadly it's the weakest stuff in the book. It consists of two
examples of using Clojure to wrap existing Java libraries. One's a
Twitter client, the other's a wrapper around Java's Date & Calendar
classes. And there's no way around saying this - both are badly written.
It would be a terrible shame if any beginner in Clojure read this
stuff and thought it was a good way to proceed. What should be a
simple function to read a config file into a map is presented in an
overwrought, brittle and O(n^2) complex fashion. Macros are used
frequently but never appropriately. Clojure code drops down into Java
interop for no good reason at all. And the author seems to have an
obsession with dynamically-binding variables, regardless of whether
it's appropriate. I strongly suspect the writer doesn't understand
what they're for. Either way, the Twitter DSL is going to break as
soon as you do anything interesting with it, like delay the results.
So is there anything here to like? Yes, the author is quite lucid. His
technical writing reads easily. I hope he writes a book on another
topic one day - but he'll need to be far better versed in the
If a Twitter API should have a cool DSL as part of it, the obvious candidate is a DSL for building Twitter query strings, like ClojureQL for SQL. The Twitter DSL in this book doesn't even touch the idea, but uses plain strings for queries.
If you're thinking about making a DSL in Clojure: 1) try to use ordinary functions first, and 2) don't buy this book.
Chapter 1 explains what DSLs are, why and when you should use them, and how the power and flexibility of Clojure lends itself nicely to making DSLs. The chapter also shows some popular Clojure DSLs in action. It's a nice introduction.
The last three chapters of the book guide the reader in creating a Twitter DSL, unit testing that DSL, and finally making that DSL a Java-callable Clojure class. Whether or not such an application should be implemented using DSLs at all is up to the judgement of the reader. Regardless, it's a great hands-on example of how Clojure can be used to make DSLs.
My low rating is due to the fact that most of this book is useless filler that's been written about many times already. I thought Chapters 2 to 8 were completely unnecessary. These chapters are an overview of the philosophy and the features of Clojure. I skimmed them because that is not why I chose to read this book. Perhaps this information would be useful to beginners, but a novice Clojure programmer should not even be learning about DSLs yet. Besides, there are already way too many 'introduction to Clojure' books for a beginner to choose from. Instead of these chapters, I wish the book talked about macros more in depth because they are used extensively in the final chapters.
Goal: to have an understanding as to when and where to use a DSL.
A DSL is a language dedicated to solving only one type of problem. The language can't make the problem domain less complex, but it can separate the complexities of the problem for the person using the language. Generally speaking, a DSL only simplifies the nomenclature of the problem domain but never completely removes it. The same terms used to solve the problem need to persist within the language, so that the expressions can be written and understood by those familiar with that particular domain.
We should also ask ourselves if we even need a DSL when trying to solve our problems, because sometimes they add more layers of complexity than the original problem.
Design concepts are well and simply defined. My favorite part is the anti patterns part where each of them is described with do and don't examples of code.
Takes you from the beginning of downloading Emacs24 and leiningen to create a working emacs leiningen structure on your computer from configuration to shortcuts step by step.
Key concepts of Clojure are given with a few examples, but readers who are unfamiliar with Clojure better overview an intro to Clojure before diving into this chapter to maximize their understandings.
and so on...