Archive for November 15, 2002

Friday, November 15, 2002 [Tweets] [Favorites]

Leaky Abstractions

Classy posts some thoughts on Joel’s Law of Leaky Abstractions. I think Joel’s basically right (that one should be careful about abstractions), but he frames his argument in a slightly misleading way.

Here’s how I look at it. An abstraction is an idea, like a specification. It can be good or bad for a particular purpose, but it can’t fail. If the implementation doesn’t conform to the abstraction it’s supposed to, then the implementation is wrong. If the implementation conforms perfectly but doesn’t have the desired effect, then you picked the wrong abstraction. Joel picks an easy target—optimistic abstractions that guarentee that everything is fast and nothing ever goes wrong—and then goes on to show that sometimes those are not the right abstractions to use. Well, duh.

He then claims that the C++ string abstraction leaks:

C++ string classes are supposed to let you pretend that strings are first-class data. They try to abstract away the fact that strings are hard and let you act as if they were as easy as integers.

What’s really going on here is that C++ does not define the abstraction that Joel wishes it did. The C++ implementation and specification do not conform to the string abstraction in his head. If you write your code assuming that strings are first-class you’ll run into trouble, but that would be your fault—not the abstraction’s.

Joel’s conclusion, “The Law of Leaky Abstractions is dragging us down,” is a tautology. It’s like saying “The bugs in our software are the reasons it doesn’t work right.”

Finder Move Problems

Nicholas Riley documents some problems with the OS X Finder. That’s like shooting fish in a barrel, of course, but I’m increasingly of the opinion that we’ve got to document this stuff (and report it via Radar) if it’s ever going to get fixed. I don’t know which problems Nicholas identified, but here are my 7:

  1. The title of the window is “Copy” even though we’re moving.
  2. It asks a question but only shows an “OK” button.
  3. There shouldn’t be a zoom box.
  4. It doesn’t say what permissions have to do with not being able to move.
  5. It doesn’t say how I could fix the permissions if I didn’t want to skip the files.
  6. It doesn’t say which items have the problematic permissions.
  7. The right side of the window looks funky with that disabled scroll bar.