Live data from Hacker News

The Law of Leaky Abstractions (2002)

joelonsoftware.com

21–30 of 93 posts

Re: The Law of Leaky Abstractions (2002)

#21

Young people should probably know that (as far as I recall) Joel more or less invented tech blogging as a form of advertising/recruiting for your company. Namely either listing out the process/perks that a good engineering team should have and how conveniently his company has it. Or describing interesting and challenging problems they solved and how you can join them and solve problems like that too. I don't recall a…

[deleted]

Re: The Law of Leaky Abstractions (2002)

#23
I first learned about "leaky abstractions" from John Cook, who describes* IEEE 754 floats as a leaky abstraction of the reals. I think this is a good way of appreciating floating point for the large group of people who's experience is somewhere between numerical computing experts (who look at every arithmetic operation through the lens of numerical precision) and total beginners (who haven't yet recognized that there can't be a one-to-one correspondence between a point on the real number line and a "float").

* https://www.johndcook.com/blog/2009/04/06/numbers-are-a-leak...

Re: The Law of Leaky Abstractions (2002)

#24
I've long been having a hunch that we're currently in the "wild west of abstraction".

I think we're missing an essential constraint on the way we do abstraction.

My hunch is that this constraint should be that abstractions must be reversible.

Here's an example: When you use a compiler, you can work at a higher layer of abstraction (the higher-level language). But, this means you're now locked into that layer of abstraction. By that I mean, you can no longer work at the lower layer (assembly), even if you wanted to. You could in theory of course modify the compiler output after it's been generated, but then you'd have to somehow manually keep that work in sync whenever you want to re-generate. Using an abstraction kinda locks you into that layer.

I see this problem appearing everywhere:

- Use framework Write from scratch

- Use an ORM Write raw SQL

- Garbage collection Manual memory management

- Using a DSL Writing raw language code

- Cross platform UI framework Native UI code

- ...

I think we're missing a fundamental primitive of abstraction that allows us to work on each layer of abstraction without being locked in.

If you have any thoughts at all on this, please share them here!

Re: The Law of Leaky Abstractions (2002)

#25

Cannot everyone get the sense that how we currently build software is one gigantic leaky abstraction?

Every abstraction leaks. A good abstraction for your domain is stable in your domain and only leaks outside of your domain. A great abstraction is separable allowing you to only drop down the abstraction level where needed and allowing the rest of the code to continue using the abstraction where the leaks do not matter, and layered allowing you to only drop down as much as needed and making it easy to rebuild parts of the upper layers on a new foundation.

Re: The Law of Leaky Abstractions (2002)

#26
post #8

I never liked the way he used TCP as an example here. I don't think it's sensible to think of "make it reliable" as a process of abstraction or simplification (it's obviously not possible to build a reliable connection on top of IP if by "reliable" you mean "will never fail"). "You might have to cope with a TCP connection failing" doesn't seem to be the same sort of thing as his other examples of leaky abstractions.…

I like the idea of TCP as a leaky abstraction because it points out the difficulty of engineering the abstraction we really want. It would be wonderful for TCP to be a guaranteed connection abstraction, but it turns out in today's world, the abstraction of a reliable connection is TCP + a network administrator + a guy with wire snips + solder (metaphorically). Maybe down the road, AIs and repair bots will be involved, and the guaranteed connection abstraction might become real or much much stronger. Although it gets more complicated because if a message takes hours to deliver, is that going to work for your application? Yes if you're archiving documents, no if you're trying to set up a video conference call or display a web page.

TCP is problematic in modern circumstances (think: Inside a data center) because a response within milliseconds is what's expected to make the process viable. TCP was designed to accommodate some element of the path being a 300 Baud modem, where a response time in seconds is possible as the modem dials the next hop, so the TCP timeouts are unuseable. QUIC was developed to address this kind of problem. My point being, the abstraction of a guaranteed _timely_ connection is even harder.

I think Joel could have expanded his thoughts to include the degree of leak. SQL is a leaky abstraction itself, yes, but my own take is that ORMs are much leakier: Every ORM introduction document I've read explains the notation by saying "here's the sql that is produced". I think of ORMs as not a bucket with holes, but a bucket with half the bottom removed.

Re: The Law of Leaky Abstractions (2002)

#27

I've long been having a hunch that we're currently in the "wild west of abstraction". I think we're missing an essential constraint on the way we do abstraction. My hunch is that this constraint should be that abstractions must be reversible. Here's an example: When you use a compiler, you can work at a higher layer of abstraction (the higher-level language). But, this means you're now locked into that layer of abstr…

Lots of abstractions have an escape hatch down to the lower level, you can put assembly in your C code, most ORMs have some way to just run a query, etc.

I think the question I have is, what benefit does this provide? Let's say we could wave a magic wand and you can operate at any layer of abstraction. Is this beneficial in some way? The article is about leaky abstractions and states

> One reason the law of leaky abstractions is problematic is that it means that abstractions do not really simplify our lives as much as they were meant to.

I think I'm just struggling to understand how this would help with that.

Re: The Law of Leaky Abstractions (2002)

#28
Joel of course hits the nail on the head about the two major things that cause abstractions to fall apart: performance and bugs (or debugging). In programming languages we talk about abstractions all the time--PL of course is all about abstractions. A computational abstraction like a bytecode, source language, or even machine code, can be proven be a proper (or full) abstraction, meaning there is no way for implementation details to leak in--you cannot observe the electrons flowing by executing A+B, after all.

...until you start measuring sidechannels, or the CPU or compiler has a bug.

I think about this a lot when dealing with VMs; a complex VM cannot hide its complexity when programs care about execution time, or when the VM actually has a bug.

Re: The Law of Leaky Abstractions (2002)

#29

I've long been having a hunch that we're currently in the "wild west of abstraction". I think we're missing an essential constraint on the way we do abstraction. My hunch is that this constraint should be that abstractions must be reversible. Here's an example: When you use a compiler, you can work at a higher layer of abstraction (the higher-level language). But, this means you're now locked into that layer of abstr…

I work on programming languages and systems (virtual machines). A key thing with a systems programming language is that you need to be able to do things at the machine level. Here's a talk I gave a year ago about it: https://www.youtube.com/watch?v=jNcEBXqt9pU

Re: The Law of Leaky Abstractions (2002)

#30

I've long been having a hunch that we're currently in the "wild west of abstraction". I think we're missing an essential constraint on the way we do abstraction. My hunch is that this constraint should be that abstractions must be reversible. Here's an example: When you use a compiler, you can work at a higher layer of abstraction (the higher-level language). But, this means you're now locked into that layer of abstr…

That's not really true of, at least C compilers. Because compilers have ABI's and fixed calling conventions, it's straightforward, documented, and not uncommon (depending on your application area/deployment target) to drop down to the ASM layer if you need to do that.

It's definitely one of those things that makes C nice for bare metal programming.

Post reply on HN