An API is a function (or functions) with the main purpose
of
allowing other programmers or programs to interact with
whatever the API was
written for.
So true.
People deal with interfaces all the
time but may not realize it. If I want to send a real, physical letter, how do
I do that?
Well, I can drop it in a special blue box. For that to work, it
will need to have proper postage affixed to it in the proper position. It will
need to have a valid, readable address, also in the proper position. It may
have to adhere to a particular physical size.
Most people don't care after
that. They don't care if the mail is picked up four times a day or once. They
don't care if it goes next to the local post office or the regional post office.
They don't care if it is transported by truck or by plane, and they don't care
if it is delivered by foot or by vehicle. They are not concerned with the
implementation details. They just know to write an address, affix
postage, drop it in the box. After that, service happens, and the intended
recipient receives it after some time.
We have also have interfaces for
buying groceries. We have interfaces for purchasing gasoline. We have
interfaces for dining out. We have interfaces for returning purchases. You may
not realize this until you go to a foreign country and realize the interface you
are used to is not employed there.
This interface to utilize the US
Postal Service is pretty straightforward. It's well known to many. There are
other useful interfaces to utilize the Postal Service; one is to go directly to
a post office and talk to a postal clerk. That interface will be different and
may provide different options or restrictions. It may require you to provide
more information. You could reasonably state it is yet another API to get a
message delivered, or you could declare it's all part of the set of interfaces
which allow one to get mail delivered by the US Postal Service. As the designer
you would be free to group them however you want, but they are still interfaces
and are intangible. They are ideas.
Once defined, you change them only at
the risk of confusing your consumers. Nobody is forbidden from changing it,
really, but if we're suddenly asked to put the postage on the back of our
letters, all the old methods (and habits) of the previous consumers would
suddenly fail to work. The inconvenience would be great and the outcry would be
mighty. Once written, APIs tend not to change in incompatible ways. They might
be extended. Postage, for instance, might be a an actual postage stamp or it
might be a meter mark from a certified meter. The postal code might have 5
digits, or it might have 9. But both are still expected, whatever form they
might take.
Describing these postal interfaces violates no copyrights. In
today's climate, sadly, implementing an interface could violate a patent,
because copyrights cover expression and patents cover ideas. It might also be
considered a trade secret. These postal interfaces, it so happens, do not
violate any patents or reveal any trade secrets.
An Application Programming
Interface can allow programmers that same level of apathy with regards to what
happens on the back end. If you call this function, and give it these
two pieces of information, the indicated result will occur. How the
function accomplishes that magic is hidden from you, and as a programmer you can
not assume anything about how that happens -- only what the API tells you.
Perhaps it will return a zero upon success. Maybe it returns a one. Maybe it
returns various values to indicate various errors or successes. But that's only
usable to you as a programmer if the interface is defined to do that. "Do this,
and you'll get that. Guaranteed. Nothing else promised."
The API tells you
how to get the code implemented behind it to do work for you. It makes complex
tasks (like getting a physical mail to your friend across the country, or
calculating a square root) seem simple. The code itself, that does the work,
arguably could be copyrighted simply because it is most easily stored in a
written form. (Insert arguments about software patents here.) But how to invoke
the code is abstract and not tangible, and IMHO is not and ought not be subject
to copyright. [ Reply to This | Parent | # ]
|