And in code itself, what does this mean for code?

Well, in code, this third step hasn’t been reached yet.

Our first step was realising there were certain things that are alive, and they imbued each other with power. Procedural programming.

The second step was realising that everything was individually alive. The code segments could talk to each other, and latch together. They had their own properties, and communicated via property exchange mediated by a space. This is object orientation.

The third step is… well, we’re not there yet, not in programming.

My evidence for this isn’t that some new fashion has replaced OOP. It’s that we currently have the largest, most extensible, most used, most popular information storage and retrieval system in the world and it’s not based on OOP. It’s the World Wide Web. It’s the 3rd step.

Did OOP ever really fulfil its potential? Can you buy an object and slot it into your system with little work, the rest of your code coming to life in new ways because it’s there? Of course not. Does Google add new life to every site on the WWW, without them being rewritten? Yes.

I saw Geoff Cohen speak at O’Reilly’s Etech 2003, and he had the best story about how object abstraction – the Newtonian model – just doesn’t work. [It’s online, as The Lie of Modularity].

On a satellite, if the on-board computer wants a file, it can load it from the cache or hit the hard-drive. Let’s pretend it needs to file to calculate a course correction. It just so happens that the file is no longer in the memory cache, so it hits the hard-drive, which – under it’s abstracted file access layer – spins up the drive… which imparts a gyroscopic effect on the satellite itself, and changes the course correction details. Leaky abstraction layers.

The thing is, and I’d propose this as a general rule, side-effects never disappear, they just attenuate – they dilute – over distance. And there are always side-effects, because when you have a transformation between one space and another space, the transformation can never be perfect and complete. It’s like converting from JPEG to PNG. You’ll get artefacts. And the side-effects always show up, somewhere in the environment.

The reason OOP didn’t take over is because this problem is writ small in everything that we do. The WWW points the way, but it’s not the end point. So what is?

[Joel Spolsky has a great essay on The Law of Leaky Abstractions, but it’s something he rails against. It’s a fact of life, he says, but he’s mainly just pointing it out. I say, why can’t we take advantage of it. Instead of focusing on making great abstractions, and then weeping when we have to join them together and actually make code, let’s go the other way. Let’s declare places where two disparate things really mingle together, take pride and really build those places where two objects have to interact, and perhaps our abstraction layers will emerge naturally out of that. I’d say that’s basically Unix scripts, where the abstraction layers – the pipes – just happen. It’s in the nature of the language.]

[One other thing about side-effects. When side-effects really build up, we call it pollution. But often we don’t notice pollution is there. When the air was clear, before factories, I’m not sure people actually noticed there was air. We had a Step 1 approach to the environment—that is, there wasn’t an environment. But the side-effects of the factories – the artefacts of the re-encoding of coal and iron into locomotives – went into the mediating spaces, and built up, and built up some more, until suddenly we went: Hey, there’s stuff between stuff! And we were forcibly moved into a Step 2 approach to the environment. It could also be argued that this always happens: emergence happens whenever something in the evolution substrate – one solution of the equations – hits the cascade, and wins. It continues cascading until it hits a barrier. At that point, it can move around until it hits the cascade again (as mammals did to primates, primates did to apes, and apes did to humans), or pollution can build up and create a new world (as oxygen did to early bacteria). This is another story, however.]

Matt Webb, posted 2005-09-02 (talk on 2005-06-11)