Identity, State, Time, and Software

A few weeks ago Sean Corfield posted another entry on the "is OOP good?" debate, and while the post was specifically about a comment he received on a previous entry, he linked to a very interesting recording of a presentation from the JVM Languages Summit by Rich Hickey: Are We There Yet? – a talk about state, identity, value, time and other concepts.

The talk is just over an hour long, and worth listening to if you ever plan on developing software in the future (regardless of language/platform/architecture/whatever).  Rich is obviously a proponent of functional programming, but his talk is more of a travelogue through the issues that have come up and been addressed (and not addressed) over the history of computer programming.

I found his discussion of persistent data structures and MVCC (multi-versioning concurrency control) particularly interesting, and certainly relevant for anyone who has ever used a database transaction and/or dealt with the "shopping cart to purchase" transition in an ecommerce app.

Another point he made (though indirectly) is that syntax is really irrelevant.  I write a lot of Groovy in addition to CFML, and I much prefer the object-centric nature of the Groovy syntax over the function-centric nature of CFML syntax.  That said, Groovy is the one that is closer to the concepts of functional programming (specifically with immutable state).  Not perfectly, mind you, but at least it's possible to think that way while it's impossible with CFML.

[1, 2, 3, 4, 5, 6, 7].findAll { it % 2 }.sort // object-y
sort findAll [1, 2, 3, 4, 5, 6, 7] { it % 2 } // function-y
a = [1, 2, 3, 4, 5, 6, 7]; findAll a, {it % 2}; sort a; // cfml-y

All three lines above do the same thing: take a literal list, pluck out the odd numbers, and return them in sorted order.  The first is a object-y syntax (a la Groovy), the second is function-y syntax (a la Haskell).  The third is CFML-y, with mandated modify-in-place so you have to mutate state, which is annoying.  Really annoying.  I want the behaviour of line two with the syntax of line one (at least as an option).

But really the point of my addled rambling is to really encourage everyone to go watch that presentation from Rich.  It's worth it.

Comments are closed.