Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Interface (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.

1 Interfaces in practice

An interface defines the means of interaction between software components - this includes constants, data types, types of procedures, exception specifications 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 separate 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 arrangement is that replacing the implementation of by another one that meets the same specifications of the interface should not cause to fail — as long its use of complies with the specifications of the interface (See also Liskov substitution principle).

2 Uses of interfaces

The concept of interface is the cornerstone of modular programming, a forerunner and a standard ingredient of object-oriented programming. In object-oriented programming, an object's interface consists of a set of methods that the object will typically respond to. Note that the object does not make its instance variables a part of its interface - these are typically accessed by means of accessor methods.

Some object-oriented programming languages mandate that the interface to the object be specified to the compiler separately from the implementation of that object, whilst others relax the requirement. For example, a class in a programming languages such as Objective-C consists of its interface, specified in a header file, and the implementation in the source file. Because of the dynamically typed nature of Objective-C, one can send messages to any object, and the interface to the class becomes important as it specifies the methods the class responds to.

Interfaces were historically derived from the header fileIn computer programming, especially using the C programming language or C++, a header file is a text file containing small bits of program code, which is used to describe the contents of the main body of code to other modules. Programs are typically brokes of the C programming languageThe C Programming Language Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language The C programming language is a low-level standardized programming language developed in the early by restricting their syntactic context and contents, and making them a part of the language semantics (as opposed to a mere preprocessor feature).

The Java programming languageJava is an object-oriented programming language developed primarily by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the fea takes a different approach to the concept of the interface normally existing in other object-oriented programming languages (ie., that the interface specified is the interface to the class), in that an interface specifies a set of methods which implement some specific functionality, common to a set of classes. See protocol (object-oriented programming)In computer science's object-oriented programming, a protocol ( Java: interface is what or how unrelated objects use to communicate with each other. These are definitions of methods and values which the objects agree upon in order to cooperate. For exampl.

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 languageAn alternate rewrite has been has been. Please refer to it for large rewrites. A programming language or computer language is a standardized communication technique for expressing instructions to a computer. It is a set of syntactic and semantic rules uses provide specific interface constructs of some kind or other:



Read more »

Non User