4 ms·
The examples don't support the argument. It's not like writing your application using UDP and expecting some packet loss is going to mean that your application
by lmm 13y ago
The examples don't support the argument. It's not like writing your application using UDP and expecting some packet loss is going to mean that your application continues to work when someone unplugs the network cable. And the other examples aren't really leaks, just performance disadvantages. I might accept an argument that any sufficiently powerful abstraction imposes a performance penalty, but that's a lot less interesting.
I've seen a single-platform JVM bug. once. The only definite OS failure I've ever seen was bad RAM, and you could write a bootable program that ran without an OS and that wouldn't protect you from bad RAM. I've seen one CPU flaw, and linux abstracted over it seamlessly. I've never seen a failure that was the result of analogue chip behaviour. There are plenty of non-leaky abstractions around.
- jhh 13y agoI think saying that some examples are just performance disadvantages rather than leaks misses the point. "Leaky" is a metaphor here, so assuming that any kind of actual data loss is necessary for it to be the case seems incorrect to me. For example if your SQL query is too slow from a pragmatic point of view and then you go ahead and fix it by using optimizer hints then the abstraction of the procedural querying process provided by SQL has just failed you as it hasn't worked. I agree that some abstractions are very good, but that does not make Joel's point moot. The key thing is to understand that abstractions are always some sort of tradeoff between the virtues of directness and the virtues of productivity. Btw: I am really surprised that this essay had never been posted to HN before.
- lmm 13y ago> For example if your SQL query is too slow from a pragmatic point of view and then you go ahead and fix it by using optimizer hints then the abstraction of the procedural querying process provided by SQL has just failed you as it hasn't worked. Well sure. But I've never had that happen; is the A = B and B = C and C = A problem the article talks about one that causes problems in real-life code?
- danielweber 13y agoI've had to rewrite lots of SQL queries (for Postgres) that an intelligent database should have just handled for me. I'd prematurely exclude certain columns that it could be mathematically proven from the query I would never need and see amazing speed-ups. (I'm not picking on Postgres, it's a wonderful DB, but you need to understand how your tools are working.)
- antimagic 13y ago"And the other examples aren't really leaks, just performance disadvantages." I don't know what your particular area of expertise is, but in my experience, performance is the reason that most abstractions fail, because there are a lot of cases where I can't simply accept the poor performance provided by the abstraction. All of a sudden I have to start worrying about what is going on behind that interface so that I can use the interface in an optimal way. And once you have to start worrying about what is behind the interface, you're in leaky interface territory. Here's my favourite example - allocators. Is my memory manager smart enough to detect that I'm allocating and disallocating a bunch of buffers of the same size, and will decide to keep some in cache for me? Can it see that I am doing a lot of allocs and frees from one thread, so it uses a special non-thread allocator for these allocs? These can be big wins in performance, and I can't leave them on the table. Some allocators do these things, but there is generally no way of knowing just by looking at the API. So you have to start hoping that the documentation explains what is being done behind the scenes, or that you have the source code, or be prepared to do some performance tests. Here's another example where an API works hard to hide a performance leak - OpenGL. Internally most OpenGL ES implementations hold texture buffers in a tiled format. This allows the GPU to copy the texture to the screen at a similar speed, no matter the orientation of the texture. If this wasn't done, you would get massive differences in performance if you rotate a texture by 90 degrees, due to memory paging issues. But with tiling this is not the case, performance is nearly constant. But this type of sensitivity to performance-based abstraction leakage is rare (and indeed creates another leak - you now need to be aware that there are potentially two copies of your texture in the system - the one you write into and the one that is actually being used by the GPU). In my opinion it is nearly impossible to create an abstraction that doesn't leak implementation information. This is not to say that abstractions are worthless, but just to highlight that abstractions need to anticipate this and provide the tools to make dealing with the consequences a bit easier.
- jheriko 13y agoi've seen a few one off hardware fails from presumably external factors like neutrons slamming into things... i've found a small handful of compiler bugs, although nowadays this is considerably rarer than it used to be (i haven't seen one in about two years and the last one was in a proprietary 'obviously not quite finished' compiler), and from working with rendering and OpenGL a bewildering number of driver bugs - some deeply embarassing like using GL_CW to signify counter-clockwise vertex winding. these cases aren't really leaky abstractions though - just bugs and i don't need to know the details to find them. this is just buggy abstraction imo. however, i do agree with your point about performance being a common leak - the most recent MS STL is an interesting example. its performance is quite horrific in some circumstances due to some very sledgehammer thread-safety approaches which are not necessary but protect bad programmers from themselves (a recurring theme in many such libraries) - in this case the abstraction is leaky in that I discover implementation details by profiling things that wouldn't normally be expected to be a performance problem... just like you say.
- oakwhiz 13y agoThis is besides the point, but I would just like to point out that Linux does have a kernel argument called "memmap" which can sometimes allow a system to operate normally by excluding a range of bad RAM addresses from being used.