The Law of Leaky Abstractions

  • Abstraction hides something complicated going on under the hood and presents the user with apparent simplicity.
  • Sometimes the underlying layer, which is problematic or complex, leaks through the abstraction.
  • The law of leaky abstractions (as defined by the author): All non-trivial abstractions, to some degree, are leaky.
  • The only way to recover from a leaky abstraction is to know what is being abstracted in the first place.
  • This means you need to learn about the underlying complexities or the logic of some of the unreliable layers, and how to work with them the hard way, without the abstraction.
  • An abstraction does save time when you are working. But if you take learning shortcuts, and have not mastered the layers and procedures behind the abstraction, any bugs from a leaky abstraction will be difficult and time-consuming to catch, let alone fix.

Full post here, 10 mins read