December 14, 2005

Freedom from Choice

In ancient Rome
There was a Poem
About a Dog
Who found two Bones
He picked at One
He licked the Other
He went in Circles
He dropped Dead
--Devo, Freedom of Choice

I stumbled across an interesting discussion in from Ruby-land through a link on Martin Fowler's website. At least I thought I did, I can't find the reference now. No matter I suppose.

It’s an intriguing, but somewhat iconoclastic idea from David Heinemeier Hansson, by way of meme consolidator Tim Case, to the effect that the notion that a framework be an ultra-flexible jack-of-all-trades has run its course. The claim is that frameworks that employ fixed conventions in lieu of elaborate configuration mechanisms are easier to learn and use, at least in the most typical and common cases. A framework should be really really good at one thing. It should do one thing, and do it well.

At first blush, this would seem at odds with conventional / customary / traditional framework development lore. Nonetheless, I find the idea quite compelling, given the right circumstances…

My first thought is that it is a sign of a healthy, mature ecosystem that the carrying capacity for frameworks that do a single thing well exists. Code that does one thing right can be easier to read, and easier to extend (using code), that code that straddles a range of requirements. There is an element of neoteny, of reverting to a less mature form in this. This is what a green fields framework often looks like too, at first.

Normally, over time, as new requirements emerge, the framework grows, to accommodate a range of requirements. The code to accommodate this variety, this diversity, is refactored as the framework grows, the commonalities rise, as if in some code chromatographic centrifuge, to the upper levels of the class hierarchy, and out into distinct components, and yes, out into the data, and into databases and configuration files.

The prize: flexibility, market share, and libraries of redeployable abstractions. The price: inevitable complexity, and a steeper learning curve.

Reversion to convention marks a break with such evolutionary trends, with midlife growth. It is tempting to speculate that such breaks are inevitability generational. That drawing-back-to-leap entails a fresh draft, a new generation, a new codebase. Hence, I suspect, the phenomenon discussed here is not warmed over YAGNI (You are not going to need it); not a response to premature generalization, but a late, mature reaction to a rising tide, and a mature understanding of where flexibility is needed in a given domain, and where it is superfluous.

Neoteny is a "back to the future" reaction, in some ways, but not a "worse is better" reflex.

An analogy drawn from the realm of stadia in the United States came (once again) to mind. During the sixties, multipurpose facilities that could accommodate the needs of several sports were constructed. They met those of all of them adequately, but met none of them well. Is a Swiss Army Knife ever really better that the right tool for the right job? Or is it just easier to afford and to carry?

During the nineties (and beyond) these cookie-cutter concrete white elephants were razed, and replaced with single-purpose facilities better suited to just baseball, or just football. Even adjusted for inflation, these replacements were considerably more expensive than the stadia they replaced. But a bigger, more affluent population, craving the thrill of vicarious victory enough to support skyboxes and three-figure seat prices, was able to support this extravagance.

Could it be, that in a red-shift, expanding universe, the growth of the internet itself, and of web application demand, is such that we now have niches for single-purpose frameworks that might only have been filled by less satisfactory general purpose code even five years ago? There is a slightly decadent, postmodern redolence about all this.

Is there any way that conventional frameworks might exhibit this same level of convenience? Perhaps, if their elements are engineered to WORK OUT OF THE BOX. By exhibiting, generating, and maintaining reasonable defaults, programmers might provide the same kind of 80% / 20% Pareto's Law hands-free convenience to the bulk of their clients, while still being able to cater to more exotic tastes as well.

Now, to be fair, one of the factors at play here is that (post-)modern scripting languages like Ruby are easier to change than relatively hidebound type-pecked tongues such as C++ and (alas, now) Java. I'm recalling Kent Beck's observation that were coding to become infinitely fast, we wouldn't need to worry very much about reuse. The fast-on-their-feet scripting cultures of Amazon and Google lend some credence to this world view, it would seem…

Freedom of Choice
is What you Got
Freedom from Choice
is What you Want
--Devo, Freedom of Choice

Posted by foote at December 14, 2005 09:49 AM