The law of leaky abstractions

I’m suspicious of people who don’t enable commenting on their blog – that just makes it a book. But this gripe aside, I like what Joel Spolsky has to say about abstraction in modern programming. Well, it pushes one of my buttons; perhaps “like” has nothing to do with it.

Sadly the people I feel need to appreciate his point the most probably won’t get past the second paragraph. That point, or at least the one I took away from it, is best summarized by this quote:

“[…] as we have higher and higher level programming tools with better and better abstractions, becoming a proficient programmer is getting harder and harder.”

Bang on. Except, maybe not harder, but just less likely. In the [invariably rapid] world of creative web development this is known as “getting shit done”. Young developers in my business don’t learn JavaScript; they learn jQuery. They don’t learn PHP, they learn [ahem] WordPress. (as if PHP wasn’t already a high level abstraction). Now don’t get me wrong! I’m not pleased about this, but there is a happy medium to be found somewhere, and I don’t believe we’ve all settled on it yet.

Joel is pretty hard on the idea that abstraction saves us time, and seems to argue that on balance the time saved working is still spent learning. Maybe this is true of people who do the learning, but many do not. And sometimes it just isn’t practical. The ActionScript world seems to be dominated at the moment by PaperVision 3D. Obviously you should have buttoned up your AS3 before diving into a library like this, but as for a solid understanding of the 3D engine; what are you going to do? Pop out for a quick doctorate in 3D mathematics in your lunch break? There is not doubt that this huge abstraction empowers many developers with some real might, with some very real time saving.

I have always maintained that the more you understand about what lies beneath the abstraction layer in which you are working the better you will be at your job. Would you train someone on Dreamweaver, before they proved they could write HTML? However, there is a balance to be found that works for you and your business. Web development would be impossible without the many layers that exist between the code in an HTML page and the OS of the server dishing it up. As the web evolves more layers tend to get added, and nowadays popular code libraries are adding layers within layers.

At the bare minimum you have this: (please excuse rudimentary linear format, and refrain from posting flowcharts)
HTML < Browser < HTTP < Server

Then we add a wizzy AJAX front end and some back end architecture:
JavaScript < HTML < Browser < HTTP < Server < PHP < MySQL

Then we use some cool 3rd party libraries to save us some work:
jQuery plugins < jQuery < JavaScript < HTML < Browser < HTTP < Server < Drupal modules < Drupal < PHP < MySQL

The more layers, the more points for possible failure. If you only have knowledge (i.e. control) of one or two of these points you are in a weaker position when things go wrong. If you have knowledge of all these layers you are in a much stronger position to harness the value of the extra layers, rather than suffer from them. This kind of philosophy is rarely evaluated when people make business decisions off the back of a Drupal press-release, but it’s one that I ensure I keep an eye on, especially when recruiting.

This area is of particular interest to me at the moment, so expect more posts on the topic.