The Law of Leaky Abstractions

All non-trivial abstractions, to some degree, are leaky.(抽象泄露法则)

The law of leaky abstractions means that whenever somebody comes up with a wizzy new code-generation tool that is supposed to make us all ever-so-efficient, you hear a lot of people saying “learn how to do it manually first, then use the wizzy tool to save time.” Code generation tools which pretend to abstract out something, like all abstractions, leak, and the only way to deal with the leaks competently is to learn about how the abstractions work and what they are abstracting. So the abstractions save us time working, but they don’t save us time learning.(抽象节省了我们工作的时间,但是没有节省我们学习理解的时间)

And all this means that paradoxically, even as we have higher and higher level programming tools with better and better abstractions, becoming a proficient programmer is getting harder and harder.(因为抽象存在泄露,所以虽然看起来我们可以使用的工具越来越多,但是成为一个高效的程序员却越来越难。因为好的程序员必须经常打破这些抽象,学习这些底层知识,否则根本没有办法接解决问题)

During my first Microsoft internship, I wrote string libraries to run on the Macintosh. A typical assignment: write a version of strcat that returns a pointer to the end of the new string. A few lines of C code. Everything I did was right from K&R — one thin book about the C programming language.

Today, to work on CityDesk, I need to know Visual Basic, COM, ATL, C++, InnoSetup, Internet Explorer internals, regular expressions, DOM, HTML, CSS, and XML. All high level tools compared to the old K&R stuff, but I still have to know the K&R stuff or I’m toast.(这么多高级内容出来了,但是你却依然需要学习K&R C语言。为什么呢?因为这些高级内容的抽象存在泄露,这些泄露的地方要求你必须学习C语言)

Ten years ago, we might have imagined that new programming paradigms would have made programming easier by now. Indeed, the abstractions we’ve created over the years do allow us to deal with new orders of complexity in software development that we didn’t have to deal with ten or fifteen years ago, like GUI programming and network programming. And while these great tools, like modern OO forms-based languages, let us get a lot of work done incredibly quickly, suddenly one day we need to figure out a problem where the abstraction leaked, and it takes 2 weeks. And when you need to hire a programmer to do mostly VB programming, it’s not good enough to hire a VB programmer, because they will get completely stuck in tar every time the VB abstraction leaks.(如果你希望找个VB程序员的话,那么不能招一个只懂VB的程序员,因为一旦抽象出现泄露,但是仅仅知道VB是不够的)

The Law of Leaky Abstractions is dragging us down.