Meaning of Leaky Abstraction?

后端 未结 11 1062
面向向阳花
面向向阳花 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:14

    The fact that at some point, which will guided by your scale and execution, you will be needed to get familiar with the implementation details of your abstraction framework in order to understand why it behave that way it behave.

    For example, consider this SQL query:

    SELECT id, first_name, last_name, age, subject FROM student_details;
    

    And its alternative:

    SELECT * FROM student_details;
    

    Now, they do look like a logically equivalent solutions, but the performance of the first one is better due the individual column names specification.

    It's a trivial example but eventually it comes back to Joel Spolsky quote:

    All non-trivial abstractions, to some degree, are leaky.

    At some point, when you will reach a certain scale in your operation, you will want to optimize the way your DB (SQL) works. To do it, you will need to know the way relational databases works. It was abstracted to you in the beginning, but it's leaky. You need to learn it at some point.

提交回复
热议问题