My Computer Forum Computer Science Forum

Go Back   My Computer Forum > Computer Science Forum > OS Architecture

OS Architecture Operating Systems and System Architecture - Operating Systems, Computer Architecture, Computer Processors


Reply
 
LinkBack Thread Tools Display Modes
April 5th, 2008, 03:43 PM   #1
 
Joined: Apr 2008
Posts: 8
API

I dont know if this topic is or should be here, but i dont know where to place it.
In my early days, which was 2 years ago while i was still studying, I have heard so many things about API
What is API anyway? How do u make it? Is it something like a mini program inside ur program that you use
or is it more like a template?

Can somebody clear this up for me? Books are a bit confusing sometimes, they try to explain but I think
I got to the point where I need somebody else to explain it to me =)

Cheers
zaiken is offline  
 

My Computer Forum is free to register and we welcome everyone!

April 5th, 2008, 06:24 PM   #2
 
Joined: Dec 2007
Posts: 187
Re: API

http://en.wikipedia.org/wiki/API
Wikipedia tells the definition in simple ways.

API is a source code interface, where operating systems and other things support requests made by computer programs.
johnny is offline  
April 5th, 2008, 10:13 PM   #3
 
Joined: Apr 2008
Posts: 8
Re: API

Does that means that any program that I make is an API?
zaiken is offline  
April 6th, 2008, 06:07 AM   #4
 
Joined: Dec 2007
Posts: 138
Re: API

API stands for Application Programming Interface. It is any set of instructions for interfacing with some "core" system. The core system can be nearly anything: A library, an OS, an interpreter of some kind, etc.

To give a few concrete examples:
Java has a very thorough API, which is well-documented here. The documentation contains a list of function calls, pre-defined variables, and how to use/access them.
In C, the Pre-processor directives are the API for the pre-processor-- they allow you to interact with it. Also, the built-in functions (e.g. printf) are part of the API for whatever library you happen to be using.

An API allows for an extra level of abstraction: Another developer using your code won't need to know what's inside of a class/function/whatever-else, he'll just need to know the calls and what, in general they do; This way he can use your code without needing to be intimate with it; also, it allows you to change the implementation, so long as you still accept the same arguments and return the same type of output: This way, if you find a better way of doing things, you don't break anyone's code.

If you are programming "correctly", you should be creating an API implicitly, even if the only person using it is yourself, and you never think about "API". Abstraction is your friend...
cknapp is offline  
Reply

  My Computer Forum > Computer Science Forum > OS Architecture

Tags
api



Thread Tools
Display Modes






Copyright © 2018 My Computer Forum Forum. All rights reserved.