Friday 14 October 2011

The Ladder of Abstraction

A beautiful piece of work by Bret Victor: http://worrydream.com/LadderOfAbstraction/


The "Ladder of Abstraction" is of course the day to day problem of programming life - both the user experience I'm trying to create, and also my own experiences of making it. Yesterday's long refactoring session was typical of both.

The key problem: if all user actions can be treated as program actions, then how about selection? As Thomas and I observed in the CDs tutorial, making a selection in a GUI creates a 'transient abstraction'. In the layer language design, I had already decided that it should be possible to refer to this abstraction via a 'selection layer'. So yesterday was the day that I grasped that nettle. Until now, selection has been an attribute of a layer. But yesterday afternoon I set about making it an independent layer. Obvious problem here - what happens when you select something in a selection layer?

My first attempt - that selection layers are 'special', is breaking my internal type hierarchy. That familiar refactoring experience, where the new abstract class looks more and more like the class you started with, because it turns out almost every aspect of the existing behaviour is essential to the concept. Last thing last night (coming home between dropping off Elizabeth at her piano lesson and collecting her, in order to get another 30 minutes coding) - leaves me with a newly refactored design that finally compiles, but the user interface consists only of selections. Everything else has become invisible. Metaphysically ironic, n'est-ce pas?

I don't expect that elegant abstractions for my end user will necessarily correspond to elegance in my own code - but I suspect this will be a space worth watching, for the integrity of the whole project.

No comments:

Post a Comment