|
Authored by: Anonymous on Friday, April 20 2012 @ 12:33 PM EDT |
I had an idea...
It would be brilliant if we had a library for loading and saving pngs, here is
my API specification
//this is a container for a PNG image
struct PNG{}
//this is the PNG loader, it takes a filenam and returns
//an object of the type PNG
//(see API specification section 1)
PNG loadPNG(String filename)
//this is the PNG writer,
//it take a PNG container and (see section 1)
//it also needs a filename
// it retusn true if the file was saved correctly.
boolean savePNG(String filename, PNG picture)
Done. This is (not a very good) full API specification.
Anyone could now go ahead and write applications that are compatible with this
library, regardless of whether or not the library exists, though you might have
to suppress compiler/linker errors for now, and it might not do much until
someone does actually produce the library.
Anyone could go away and write their own implementation of this library, if
those implementations conform to the above specification, they can be dropped in
, and all applications that require these API calls will function.
This is one of the reasons why APIs are referred to as being abstract.
An API Specification is a book, or an HTML version of a book
[ Reply to This | Parent | # ]
|
|
|
|
|