Interface (computing)

This is an old revision of this page, as edited by Dysprosia (talk | contribs) at 05:31, 28 April 2004 (an interface itself is not a software component - it is a specification - +other more generalizing features). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer science, an interface is a specification that exists between software components that specifies a selected means of interaction, by means of properties of other software modules, which abstract and encapsulate their data.

An interface defines the means of interaction between software components - this includes constants, data types, procedures, and method signatures. In some instances, it may be useful to define variables as part of the interface. It often also specifies the functionality of those procedures and methods, either by comments or (in some experimental languages) by formal logical assertions.

The interface of a software module is deliberately kept seperate from the implementation of that module. The latter contains the actual code of the procedures and methods described in the interface, as well as other "private" variables, procedures, etc.. Any other software module (which can be referred to as a client to A) that interacts with is forced to do so only through the interface. One practical advantage of this arrangment is that replacing the implementation of by another one that meets the same specifications of the interface should not cause to fail — as long as the implementation of complies with the specifications of the interface.

The concept of interface is the cornerstone of modular programming, a forerunner and a standard ingredient of object-oriented programming. Interfaces were historically derived from the header files of the C programming language by restricting their syntactic context and contents, and making them a part of the language semantics (as opposed to a mere preprocessor feature).

Certain programming languages have different methodologies for allowing the construction of interfaces. In general, any programming language can implement an interface, but the following programming languages provide specific interface constructs in the programming language of some kind: