Meaning of Leaky Abstraction?

后端 未结 11 1123
面向向阳花
面向向阳花 2020-12-23 02:33

What does the term \"Leaky Abstraction\" mean? (Please explain with examples. I often have a hard time grokking a mere theory.)

11条回答
  •  忘掉有多难
    2020-12-23 03:09

    Wikipedia has a pretty good definition for this

    A leaky abstraction refers to any implemented abstraction, intended to reduce (or hide) complexity, where the underlying details are not completely hidden

    Or in other words for software it's when you can observe implementation details of a feature via limitations or side effects in the program.

    A quick example would be C# / VB.Net closures and their inability to capture ref / out parameters. The reason they cannot be captured is due to an implementation detail of how the lifting process occurs. This is not to say though that there is a better way of doing this.

提交回复
热议问题