Clojure Gazette 1.61
React, bugs, and some thoughts
December 07, 2013 ==============================
Greetings, developers of all stripes!
I can't help but feel excited by recent events. As you may know, I am gainfully employed as a programmer, primarily developing in Clojure and ClojureScript. Before that, Clojure was only a very serious hobby. I never had the time or a reason to contribute to Clojure libraries (besides my own few Github repos). However, since I started working I have submitted several patches to open source projects that we use. There are likely more patches and some libraries of our own to come. This makes me happy.
I have attended three conferences organized by Alex Miller this year. I met many great people.
I produced a successful Kickstarter campaign and received the support of the community. Sales continue and a second video is on its way, which I have now started in earnest.
When I started the Gazette, I felt like an outside observer. I had been programming a lot in Clojure, looking in, but I had very little claim to be inside. Now I feel a part of the community, and I like it. There is a reason the language and libraries are so great: it's the people. There are great minds doing great things.
I am feeling good today. I think this issue reflects that.
P.S. I love hearing from readers. Just reply to this email!
The Library to Watch
Some funding for this project was provided by the Typed Clojure Indiegogo campaign, and now there is more funding from Cognitect. These libraries are a step toward Clojure implemented in itself, which will make the compiler even more accessible. Also, the tools.analyzer library is useful for static analyzers (like Typed Clojure) and compilers for new targets. I'm looking forward to what comes out of this.
The Developer to Watch
While thinking of developers to highlight in this inaugural spot, I could think of none better than David Nolen. David maintains ClojureScript, core.logic, core.match, and mori. He is also influential in Clojure at large. Not only is he a prolific coder, he is also an insightful blogger and great to follow on Twitter . He's friendly, so say hi to him on IRC or in real life.
Tests and Testables
A good read by Michael Nygard about alternatives to unit testing, with pointers to libraries that help with the different techniques.
Harmful Considered Harmful
I am a fan of Douglas Crockford because he has reasoned opinions and he can explain the reasons well. That is something I aspire to. This podcast touches on the importance of history in software engineering, how our tools help us or hurt us, and what should be our goal as developers.
Douglas Crockford continues to inspire me to think about what it means to develop software well and how we can craft tools that help us do that. I learn something new every time I hear him talk. I don't always agree, and sometimes he "oversimplifies", but it is always intelligent.
Equal and opposite reaction
The part that excites me the most is the "Virtual DOM", which is a copy of the DOM maintained by React. Instead of adding or changing nodes directly in the real DOM, you render a new Virtual DOM. React then compares it to its copy, calculates the "minimal" set of operations to the real DOM based on the differences, then performs the operations in batch. It minimizes DOM manipulation and leaves the focus intact. This allows you to write your view functionally (a function from values to Virtual DOM nodes) and React takes care to do the actual rendering.
This solves the "two-way binding" problem that I have always faced when programming on the web. David Nolen has posted a couple of gists ( here and here ) exploring React's use in ClojureScript. By taking advantage of ClojureScript's immutable data structures, David Nolen has found a further optimization that would make even performing the Virtual DOM diff unnecessary most of the time. Inspired by those gists, I have been using hiccup markup to generate React Virtual DOM trees (I will release an alpha in the next couple of weeks). I coded a small internal app in it (actually, converted a half-finished, buggy JQuery app) and the results so far are remarkable. Fast DOM. Functional DOM. No DOM operations.
He's on every channel!
This Rich Hickey talk delivers a talk motivating core.async and explaining what it does. You may be familiar with core.async, but this talk is still worth your attention. The attention Rick Hickey pays to the background of CSP is edifying.
Commutation for fun and profit
I saw this talk at Strange Loop 2013 . It is about data structures that allow commutative operations using constant space. Often this is done by losing some information---the value is merely a very good approximation. The talk begins with some very simple examples, but soon gets into cool, deep territory. Avi Bryant delivers it all smoothly, so you never feel out of you depth.