Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 27th, 2005, 4:46 AM   #1
linuxpimp20
Hobbyist Programmer
 
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4 linuxpimp20 is on a distinguished road
what is the difference between an API and a library?

hi. i didn't know what API stands for so i looked it up. to me a library and an API sound similar to a library but im sure there are some differences that i don't know about. It soundslike a library could be part of an API but i dunno. Is a library moreso to make new programs and an API is to help developers develop an existing program? thanks for any replies in advance
linuxpimp20 is offline   Reply With Quote
Old Aug 27th, 2005, 5:27 AM   #2
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 3 Polyphemus_ is on a distinguished road
just google for 'define:api'. You will find loads of definitions.

One description:
Quote:
API
application program interface; the specific method prescribed by a computer operating system or by another application program by which a programmer writing an application program can make requests of the operating system or another application.
Polyphemus_ is offline   Reply With Quote
Old Aug 27th, 2005, 5:28 AM   #3
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,198
Rep Power: 5 grumpy is on a distinguished road
A library is not part of an API; the reverse is closer to being true. The API (Application Programmers Interface) is the specification of how applications can use the library.
grumpy is offline   Reply With Quote
Old Aug 27th, 2005, 5:33 AM   #4
linuxpimp20
Hobbyist Programmer
 
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4 linuxpimp20 is on a distinguished road
Quote:
Originally Posted by Polyphemus_
just google for 'define:api'. You will find loads of definitions.

One description:
i did so prior to posting.
linuxpimp20 is offline   Reply With Quote
Old Aug 27th, 2005, 5:36 AM   #5
linuxpimp20
Hobbyist Programmer
 
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4 linuxpimp20 is on a distinguished road
Quote:
Originally Posted by grumpy
A library is not part of an API; the reverse is closer to being true. The API (Application Programmers Interface) is the specification of how applications can use the library.
so they aren't really similar but closely tied? An API is rules on how to use a library? Does that mean it is another layer between the library and program so the program is more modular and if it need to be ported to use a new library you just have to alter the API? thanks for your quick replies.
linuxpimp20 is offline   Reply With Quote
Old Aug 27th, 2005, 5:55 AM   #6
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
Quote:
Originally Posted by linuxpimp20
so they aren't really similar but closely tied? An API is rules on how to use a library? Does that mean it is another layer between the library and program so the program is more modular and if it need to be ported to use a new library you just have to alter the API? thanks for your quick replies.
The API is, as the name states, the interface specification. It specifies how the application programmer should use the library and the behaviour of the library in reaction to calls. For a call to a function, pre-call states and post-call states are defined, parameter types, return types, events, error codes, etc. etc. It does not, in accordance with the 'black box' principle, explain what goes on INSIDE the library. This information should not be necessary, and if the library developer were to change the internal design, it could possibly be harmful.
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old Aug 27th, 2005, 7:25 AM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
You don't want to write the all code to operate your system. You don't even want to learn all the code that already exists to operate your system. All you want to do is learn to invoke the code that operates your system. If the invocations are standardized, remain unchanged, and always result in the promised operation, you are in Fat City. If the operations are improved internally without deep-sixing your efforts, no sweat. This little piece of lagniappe given you by the people that actually wrote all that code, is the API. In my opinion, it includes the small layer of software necessary to standardize the invocations, as well as the detailed instructions for using it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC