Jump to content

API

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 24.108.233.xxx (talk) at 06:01, 30 July 2001. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

API is short for "Application Programming Interface".

APIs exist because in Computer software nobody wants to write their program from scratch.




Let's say I want to write the message "Hello, World" to the computer screen.

Here are two possible ways I could do this:




1a. Draw, on graph paper, the shapes of the letters H, e, l, o, W, r, d.


1b. Work out a matrix of black and white squares that look like those letters.


1c. Work out the sequence of electrical pulses that I need to send to the computer screen to draw that matrix. It might be 5 volts for black, 1 volt for white.


1d. Repeat the sequence every 60th of a second to keep the message displayed, exploiting persistence of vision.




2. Use somebody else's program to do all this hard work.




Not surprisingly, most computer programmers choose the second option. APIs are the standardised way of reusing the other person's work.




APIs are as essential to computers as electrical standards are to the home. I can plug my toaster into the wall whether I am at home or at my neighbour's house, because both houses conform to the standard (API) for a British electrical socket. Note that there is nothing stopping somebody else coming up with another standard; my toaster will not work in the US, just as a program written for Microsoft Windows will not work on a Apple Macintosh.




If there wasn't an API standard, I would have to bring a power station with me to make my toast!




Computer software companies often jealously guard their APIs. For example, Sony charges a large amount of money before you can even see the SDK documentation. This is because they don't want any Tom, Dick or Harry writing a PlayStation game. Microsoft deliberately makes their API information public, so that software will be written for the Windows platform. The sale of the third party software sells copies of Windows.




There are other APIs that are totally free, such as those issued under the GNU General Public License.




(Note: This article needs quite a bit of editing and correction.)