维基中抽象的定义:
Computer scientists use abstraction to make models that can be used and re-used without having to re-write all the program code for each new application on every different type of computer. They communicate their solutions with the computer by writing source code in some particular computer language which can be translated into machine codefor different types of computer to execute. Abstraction allows program designers to separate categories and concepts related to computing problems from specific instances of implementation. This means that the program code can be written so that it does not depend on the specific details of supporting applications, operating system software or hardware, but on an abstract concept of the solution to the problem that can then be integrated with the system with minimal additional work.wiki
抽象主要是用来 隐藏细节和代码重用。
将 值,函数,对象。。标记为一个个记号,在任何地方想用到某个被标记的东西时,直接使用记号。实现了代码重用,和程序结构化。
代码抽象包装后,使用者可以不必知道其实现细节,而只知道 input 和output 就可以。这样所有人已经写好的实现都可以分享共用。