i understand it's an acrynom that means "Application Programming Interface", but what does that mean? in laymen's terms please... i'm not the sharpest cookie in the breadbox
... i'm not the sharpest cookie in the breadbox
I figured that out from your post. Try Google next time. Second result for API is wikipedia. Very informative.
oh snap... yeah i read the wikipedia entry, still don't get it.
i understand it's an acrynom that means "Application Programming Interface", but what does that mean? in laymen's terms please... i'm not the sharpest cookie in the breadbox
I'll give you an example. Let's say you write a program for the iPhone. And if the user presses a certain button, then the iPhone is supposed to call _you_. Your phone number is 1234-5678-9123. So if your program is written in C, C++, Objective-C, or Java, you would have written some code that looks like
if (PhoneHomeButtonPressed ()) {
... something must go here...
}
That's were the API comes in. The API describes what function or functions you must call to do what you want to do. It doesn't say how these functions work, that can actually change. The code in the iPhone operating system that dials a phone number could be different in iPhone 1.1 and iPhone 2.0. But that doesn't matter. The API (Application Programming _Interface_) tells you what the interface looks like, for example
if (PhoneHomeButtonPressed ()) {
iPhoneHardware.DialNumber ("1234-5678-9123");
}
(I just made the code up completely, but it would be half reasonable that the actual call might look like this). So an API describes what application programmers need to know to use the features of an iPhone. It doesn't say how the feature works, that is often of no interest to you.
The API would also tell you what you would have to do to say call a phone number in France, or call a phone number in France if the phone itself is in Britain and not in Germany or the USA (you might have to do things differently), and it would tell you how to find your location.
So a programmer needs to know two things: They need to know the general rules of programming. How to put things together logically. These are things that work the same on every computer. And then they need to know the rules for the features of the computer they are programming for, and that is the API.
Interface Builder also considered an API?
Another answer is that an API is a set of programming libraries (i.e. ready-made code) provided by a third party that allows you to access features of their system/software/device in your own programs. Examples:
The iPhone SDK provided by Aapple gives you an API for accessing iPhone features like the accelerometer and the touch screen gestures.
The Windows SDK provided by Microsoft allows programmers to access Windows features like creating actual windows, printing, etc.
(In case you haven't noticed SDKs pretty much always include API libraries).
Interface Builder itself is just an application that helps you build resource files (aka NIB files) which can be used in conjunction with the Mac OS APIs.
Strictly speaking, an API only includes code libraries/frameworks that allow people to program for a particular system. Other tools like XCode, Interface Builder, etc. are not part of the API but are part of the SDK.
All programs are made of code written in some language. An API is simply a collection of code that has been already written for you to use. That way the developer doesn't waste time re-writing the same things over and over and everyone has a consistent way of doing things. For example creating a windows on the screen. All windows should look and behave the same (generally speaking). There is no point in having each program custom write code to do that. So Apple wrote it and other developers just use it to create windows. API's are not for just windows or GUI stuff of course. It could be anything. Reading/Writing to files. Creating connections over a network. Sorting data. Down to just low level system stuff. The API's are there to let you worry about your own program and less about how to do things that the Operating System should handle.
This may not make much sense, but this is the documentation for the Java API to give you an idea:
http://java.sun.com/j2se/1.5.0/docs/api/