The Mac OS Xclave

 

 

 

 

 

 

 

 

main page

 

Information briefs

macos x server

macos x (client)

darwin

netboot

 

Installation reports

PHP 3

PHP 4 (Zend)

MySQL

Python
(coming soon)

 

Special Reports

Apple Media Event
10/99
new iMacs
and MacOS 9

1999 wwdc keynote

Quick and Dirty
MacOS X Server
Installaion Guide

 

Articles

 

News Archive

1999

1998

RhapNet
(coming soon)

 

Advertising info

 

Contact Us

 

About Us

 

Links

 

The Tweak List

 

 

 

 

Tweak List: API

API stands for Advanced Programming Interface.

When programmers program, they want to do the best job they can with the least amount of work possible. So, it is always nice to have shortcuts. That is, essentially, what an API is - a collection of related programming shortcuts which aim to lower coding time.

APIs are created for a number of reasons.

Personal convenience is a big reason. For developers and companies, it makes sense to create a set of APIs which are written to be used by either in-house programmers who are writing applications, and third-party developers wh o wish to extend the the usefulness of these programs.

Another reason is to draw developers into utilizing or making additions to for their product. When Microsoft made the transition from Windows 3.x to Windows 95, they crafted the Win32 APIs. Win32 was written specifically to replaced the old Win16 APIs and to extend the Windows platform.

Win 32 is the basis for all native Windows applications. It provides Win 95 developers with a universal set of functions which the platform supports, including drawing functions, file access, access to I/O, etc.

All major operating systems have their own APIs. Apple has the Mac APIs for the MacOS, and will soon have both Yellow Box and Carbon APIs for the MacOS X platform.

These APIs are tools that allow programmers to write programs for a specific platform without spending time "reinventing the wheel."

Perhaps a simple example would help to illustrate the point. Let's say that you want to draw a simple box on the screen.

Case 1: Figure out the coordinates of the four corners of the box. Plot each of those points. Then draw lines between the four corners.

(Sample psuedocode)

//Assuming four points:

x1 - upper left
x2 upper right
y1 lower left
y2 lower right
 
DrawLine(x1,y1, x1, y2);
DrawLine(x1,y1,x2,y1);
DrawLine(x2,y1,x2,y2);
DrawLine(x1,y2,x2,y2);

Case 2: A function from the Drawing API called DrawBox would require only the top-left corner and the bottom-right corners, and would do the rest of the work for you. Written properly, the function could also just as easily add color to the box, a texture, change the color of the connecting lines and more..

(Sample psuedocode)

//Assuming four points:

x1 - upper left
x2 upper right
y1 lower left
y2 lower right
 
DrawBox (x1,y1,x2,y2);

If you were writing a program which would involved drawing boxes to the screen, you would greatly appreciate the existence, flexibility, and power of a predefined DrawBox function over Case 1.

APIs which are powerful, intuitive, and well-documented help to bring developers to companies seeking developers.

 

 

 

 

 

 

 

 

 

All content - ©1998-2010 - Mark J. Hershenson

 

 

 

 

 

The MacOS Xclave is hosted by green-ant.com.