Interface (computing)

This is an old revision of this page, as edited by Jorge Stolfi (talk | contribs) at 04:03, 28 April 2004 (link to Microsoft .NET). 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 software component that specifies selected properties of other software modules, used for abstraction and encapsulation of data.

An interface normally defines a set of constants, data types, variables, procedures, and method signatures. It often specifies also 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 (client) 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 should not cause to fail — as long as its use 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 of some kind: