Quantcast
Viewing latest article 1
Browse Latest Browse All 3

Answer by Barmar for Difficulty understanding APIs and the DOM

An API is a specification of functions and data structures that are used by an application to interact with some other service and/or data structures.

An example is the POSIX operating system API (functions like open() and read() for accessing files, fork() and exec() for managing processes and programs, etc.). POSIX specifies the API, which allows programmers to write portable programs that will run on numerous different operating systems by using these functions.

Another example is the DOM API in web browsers. The DOM is an abstract data structure, and the DOM API is methods like getElementById() and appendChild() that act on the data structure, which the browser then displays. Each browser has its own implementation of this API, which allows Javascript applications to run across different browsers.

APIs are not inherently specific to an implementation. But in cases where service providers have a library for making use of their service, the API and its implementation are often conflated. For instance, to use the Stripe service for processing credit card payments, you would use the Stripe API that they've written. Theoretically, all the payment processors like Stripe, PayPal, SWReg, etc. could get together and define a common API, which they would all implement, but they haven't done so AFAIK.


Viewing latest article 1
Browse Latest Browse All 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>