Application programming interface |
: This article is about the computer software usage of API. For other uses, see API (disambiguation).
An application programming interface (API) is a set of definitions of the ways one piece of computer software communicates with another. It is a method of achieving abstraction (programming), usually (but not necessarily) between lower-level and higher-level software.
=Description=
One of the primary purposes of an API is to provide a set of commonly-used . An SDK may include an API as well as other tools/hardware, so the two terms are not strictly interchangeable.
Higher-level APIs often lose flexibility; for example, it would be much more difficult in a web browser to rotate text around a point with blinking outlines, something that could be done at the lower levels. This difference is a typical example of the trade-offs encountered by choosing to use an API.
APIs are as essential to computers as electrical standards are to the home. One can plug a toaster into the wall whether at home or at a neighbour s house, because both houses conform to the standard electrical interface for an electrical socket. If there weren t an interface standard, one would have to bring a power station along to toast a bagel! Note that there is nothing stopping somebody else coming up with another standard; a European toaster will not work in the US without a transformer, just as a program written for Microsoft Windows will not run directly on a UNIX system without an intermediate API adapter such as Wine (software).
There are various design models for APIs. Interfaces intended for the fastest execution (computers) often consist of sets of functions, Procedures, Variables and data structures. However, other models exist as well, such as the interpreter (computer software) used to evaluate expressions in ECMAScript/JavaScript. A good API provides a black box or abstraction layer, which prevents the programmer from needing to know how the functions of the API relate to the lower levels of abstraction. This makes it possible to redesign or improve the functions within the API without breaking code that relies on it.
Two general lines of policies exist regarding publishing APIs:
# Some companies guard their APIs zealously. For example, Sony used to make its official PlayStation 2 API available only to licensed PlayStation developers. This is because Sony wanted to restrict how many people could write a PlayStation 2 game, and wanted to profit from them as much as possible. This is typical of companies who do not profit from the sale of API implementations (in this case, Sony broke even on the sale of PlayStation 2 consoles and even took a loss on marketing, instead making it up through game royalties created by API licensing). However, PlayStation 3 is based entirely on open and publicly available APIs. # Other companies propagate their APIs freely. For example, Microsoft deliberately makes most of its API information public, so that software will be written for the Windows System platform. The sale of the third-party software sells copies of Microsoft Windows. This is typical of companies who profit from the sale of API implementations (in this case, Microsoft Windows, which is sold at a gain for Microsoft).
Some APIs, such as the ones standard to an operating system, are implemented as separate Library (software) that are distributed with the operating system. Others require software publishers to integrate the API functionality directly into the application. This forms another distinction in the examples above. Microsoft Windows APIs come with the operating system for anyone to use. Software for embedded systems such as video game consoles generally falls into the application-integrated category. While an official PlayStation API document may be interesting to read, it is of little use without its corresponding implementation, in the form of a separate Library (computer science) or Software development kit.
An API that does not require royalties for access and usage is called open. The APIs provided by Free software (such as all software distributed under the GNU General Public License), are open by definition, since anyone can look into the source of the software and figure out the API. Although usually authoritative reference implementations exist for an API (such as Microsoft Windows for the Win32 API), there s nothing that prevents the creation of additional implementations. For example, most of the Win32 API can be provided under a UNIX system using software called Wine (software).
It is generally lawful to analyze API implementations in order to produce a compatible one. This technique is called reverse engineering for the purposes of Interoperability. However, the legal situation is often ambiguous, so that care and lawyer should be taken before the reverse engineering is carried out. For example, while APIs usually do not have an obvious legal status, they might include patent that may not be used until the patent holder gives permission.
=Example APIs=
*The PC BIOS call interface *Document Object Models of various applications, such as HTML *The Single UNIX Specification *The Microsoft Win32 API *The J2EE Java 2 Enterprise Edition APIs *ASPI for SCSI device interfacing *The Carbon (computing) and Cocoa (software) APIs for the Apple Macintosh Mac OS X *The various APIs which make up Microsoft s DirectX *Simple DirectMedia Layer (SDL) *The Linux Kernel API [http://kernelnewbies.org/documents/kdoc/kernel-api/linuxkernelapi.html] *The Universal Home API
=See also=
*Ontology (computer science) *Application binary interface (ABI) *Plugin|
|
