Tesugen

Re: Joel’s law of leaky abstractions (Irrational Software)

I like Joel Spolsky’s The Law of Leaky Abstractions – particularly his excellent illustrations of the concept of abstractions. I also like his argumentation about how abstractions are more likely to “leak” the less trivial they are. But I don’t know if I would go so far as to call it a law.

It certainly is true that many high-level abstractions leak and cause difficult bugs, but to use the word law suggests that it’s virtually impossible to create leak-proof high-level abstractions. Of course, at a certain level it definitely is impossible – there’s always something that can go wrong – but what’s interesting is that they for the most time are leak-free; that they have a low enough “mean-time between leaks (MTBL).”

To me it seems that it has much to do with abstractions communicating errors to their users in as meaningful a way as possible. Errors shouldn’t just be passed through an abstraction, to abstractions that build upon them, but instead be either wrapped with more information added onto it, or completely rephrased (but keeping the original error details).

I’m also thinking about the importance of using powerful abstractions, basing them on powerful metaphors that not only are meaningful when everything runs smooth, but also cover the errors that might occur. Joel’s example of the ASP.NET abstraction for hyperlinks, that breaks if the user has JavaScript turned off, is to me a case of building an abstraction upon a fragile inferior abstraction, so to speak. If the underlying abstraction is broken (that is, that JavaScript is switched off), the above abstraction is completely useless. The error JavaScript is disabled simply doesn’t allow for easy rephrasing on the higher level, which signals that it was unwise to base it on hyperlinks and JavaScript.

When I read this I came to think about Charles Simonyi’s intentional programming – which I can’t say I have understood fully yet, but it perhaps addresses this. See my posts Intentional programming and More on Intentional Programming.

Follow-up: As I edited this post, I associated the idea of how abstractions must cover its errors with Richard Gabriel’s slides from the OOPSLA 2002 debate, entitled Objects Have Failed, that says that “Failures are called exceptions, while in the real world failures are called “that’s life.”“

The above was posted to my personal weblog on November 12, 2002. My name is Peter Lindberg and I am a thirtysomething software developer and dad living in Stockholm, Sweden. Here, you’ll find posts in English and Swedish about whatever happens to interest me for the moment.

Tags:

Related posts:

Posted around the same time:

The seven most recent posts:

  1. Tesugen Replaced (October 7)
  2. My Year of MacBook Troubles (May 16)
  3. Tesugen Turns Five (March 21)
  4. Gustaf Nordenskiöld om keramik kontra kläddesign (December 10, 2006)
  5. Se till att ha två buffertar för oförutsedda utgifter (October 30, 2006)
  6. Bra tips för den som vill börja fondspara (October 7, 2006)
  7. Light-Hearted Parenting Tips (September 16, 2006)
Bloggtoppen.se