wikipedia Interface (computing)
In computing, an interface is a shared boundary across which two or more separate components of a computer system exchange information. The exchange can be between software, computer hardware, peripheral devices, humans, and combinations of these.[1]
NOTE:
1、上述对interface的定义是非常地正式的
Hardware interfaces
Main article: Hardware interface
Software interfaces
See also: Application binary interface and Application programming interface
In object-oriented languages
Main articles: Protocol (object-oriented programming) and Concept (generic programming)
Programming to the interface
NOTE:
1、这段关于Programming to the interface的描述是非常好的
The use of interfaces allows for a programming style called programming to the interface. The idea behind this approach is to base programming logic on the interfaces of the objects used, rather than on internal implementation details. Programming to the interface reduces dependency on implementation specifics and makes code more reusable.[12]
Pushing this idea to the extreme, inversion of control leaves the context to inject the code with the specific implementations of the interface that will be used to perform the work.