Sunday, July 01, 2012

Book Review: Clojure Programming by Emerick, Carper, and Grand

Clojure ProgrammingClojure Programming by Chas Emerick
My rating: 4 of 5 stars

When I first started reading Clojure Programming, the first impression I had was that I've never seen a programming language introduction try so hard to tell me that my programming skills are going to grow significantly as a result of learning this programming language. This book is probably not for beginners, but working through this gives insights into why certain programming constructs work the way they do and how functional programming constructs fit with someone who is used to procedural and object oriented programming. While the efforts it makes to declare its superiority towards other languages gets annoying, the practice in using the REPL actually helps me understand how to better use tools I use in other languages.

My background is in scientific computing. And while I have used some standard languages such as Java, C, C++, and even Fortran, my first choice in languages tends to be either R or Python. The R environment is admittedly ugly, but in Python I typically use tools that surround the scientific ecosystem of ipython/Numpy/Scipy/Matplotlib. My programs tend to be structured into a data gathering and manipulation portion (MVC) then an analytics portions dominated by a series list comprehensions and map-apply and finally presentations of results. In this context, I first heard of Clojure because the Incanter: Data Sorcery project, which was an attempt to create a Lisp-based statistical computing and graphics platform. So I approached Clojure Programming with a view of its suitability for technical computing, or a way of learning functional programming techniques in a deeper fashion for use in R or Python data analytics.

It somewhat disappoints in this. When Clojure Programming put effort into demonstrating its unique points, such as the REPL, I kept on thinking "I already have this in Python/ipython" (in particular the ipython shell gives considerably more capability than the standard shell) When reaching the Numerics chapter, it seemed to be a discussion of standard data types (and when trying to discuss Python numerical types, not acknowledging Numpy data types and discussing performance is ignoring the real world.) My main complaint is that the discussions of language and environment features feels like I'm being presented with a long list of details, without having first having a general sense of what programming would be like.  In many ways, it is similar to learning scientific programming in Python.  You generally learn general programming first, and later on you learn the techniques for data analysis, many of which are based on functional programming practices.

What the book does well is explain deeply the principles behind the language and functional programming.  In works through them with cross references in the text wherever they are necessary.  And it explains why these principles are useful.   In particular with the REPL, which if I had not had experience with the ipython shell would have been quite different then other shells.

What this leads me to conclude is that this book would be very good for someone with a solid grasp of Java programming, with its ecosystem and libraries, and wanted to move into functional programming.  Clojure Programming provides a different workflow since it does compile/evaluate as you go, allowing you to see quickly the results of changes without any performance penalty. And having a different programming paradigm than object-oriented adds a set of tools that can be brought to bear under a different situation.

This was not quite what I was hoping for, but that may be because the tools and language features of Python/ipython were already overlapping with Clojure.  It does fulfill the promise of making me a more knowledgable programmer.  And I hope that working through Clojure Programming also makes me a better one.

Disclaimer:  I received a free electronic copy of Clojure Programming as part of the O'Reilly Press Blogger program.

I review for the O'Reilly Blogger Review Program
View all my reviews

Parenting 20 months: Where did mommy and daddy go?

Walking around Toronto Music Garden

This was a month of traveling. First, the whole family went off to Toronto for Auntie J's wedding. Another road trip and use of a passport for our little traveler. First we stopped in Buffalo to visit V and E. And Donut, the resident cat. Although Donut has never seen a toddler before, he clearly understood the dangers of a toddler who was way to happy to see a cat and want to play with. We had plenty of amusement watching Donut scamper away followed by T running after him crying out 'Do! Do!'

Next was Toronto. T was a very good traveller, helped by the wonders of modern technology in the form of an iPad loaded with Ni Ha, Kai-lan and an iPod loaded with the Sound of Music (yes, the Sound of Music is still going strong in this house).

We arrived in Toronto for lunch with M and family, then was the wedding, T's first. He took the opportunity to sign the guest book. Signing the guestbook

He was not so impressed with the ceremony, but he did get to enjoy the dance floor. Watching the guests dance

And he even got to play with auntie J after taking a tour of downtown Toronto before heading back home. Playing with auntie, mommy, and Elmo

But the most momentous event of the month was a different trip. And this was without him. While both of us have travelled without him this was the first trip where both of us left at the same time, leaving him with grandma and grandpa. Because as much as we love him and as good as he is in traveling and going out and about. It is nice to have some time without him.
From Baby Blog
In other news, he is talking alot more now. He likes to say 'Hi' (although he is picky on who he says it too). He has stopped gaining weight, but he still has his appetite. Basically he is leaning out instead of gaining weight. I like to think it is because he is getting more exercise. And with all his new experiences, he has lots to say. A baby with something to say sitting in a chair with a croissant and a puzzle