what do the words platform and api exactly mean?
i've bought a book "learning the java SE 6 platform". i wonder what the word platform really means. cause isn't it just a bunch of classes that i can use. the JDK 1.6 node in Netbeans under Libraries.
And what is API? isn´t it the same thing as platform. But doesnt library mean the same thing..a bunch of classes with some superclasses and so on?
The term "platform" is used to denote any collection of software, services and resources that, within a specific context, are considered a given so they can be used as building blocks for application software (or to build a higher level platform on top of that - something considered a platform in another context)
API is an acronym for application programming interface. This usually means the collection of calling conventions (function signatures and the like) that can be used by an application (the program you are writing) for perusing functionality residing inside a library or a platform.
An API is not the same as a library - the term Interface conveys that it only specifies what you can call, and how that behaves. The actual library that implements the interface can decide for itself how it delivers the specified functionality.
A good example of an API is for example the JDBC API - this is the standard way for java programs to communicate with databases. Each database vendor has its own protocol for connecting to the database, binding variables and such to database commands, but the JDBC API abstracts all that and defines a common ground what allows all java programs to use the same set of functions to talk to - ideally - any database. It is the database vendor's job to actually provide a driver, that is, implement a library that is in accordance with the API and knows how it can fulfill its tasks for that particular database system. So in this case you have many driver libraries (each vendor has their own, sometimes multiple ones) but they all deliver their functionality through the same set of functions, classes etc. specified by the API (in this case, the JDBC API - see http://java.sun.com/j2se/1.5.0/docs/api/java/sql/package-summary.html
Sometimes, an API is so extensive that it is considered a platform, but the term platform is more general, a platform does not need to be an API. For example, the collection of standard UNIX utilities like ls, grep, cd etc. can be considered a platform, but not so much an API.
The Java platform consists (roughly) of the following:
- The Java programming language
- The Java API
- The Java Virtual Machine
There's a quite a bit of details in the Wikipedia article on Java (software platform).
The API, or application programming interface, alone provides the classes that come with the Java platform. For example, when one says the "Java API", one would probably be referring to the class libraries which come with the Java SE platform.
Just for the sake of providing links, here are the official documentation for each part of the Java platform:
- The Java programming language - The Java Language Specification
- The Java SE API - Java Platform, Standard Edition 6 API Specification
- The Java Virtual Machine - The Java Virtual Machine Specification