[prog] APIs for dummies?

Hamster hamster at hamsternet.org
Thu Sep 18 16:11:46 EST 2003


Michelle,

I have no idea if what I"m going to suggest is appropriate for your
situation, but this is how I do it in bash. Other scripting languages might
be similar.

Create a single file containing the functions you wish everyone to be able
to access, and then when ever anyone wants to use those functions, they just
call that file from whatever programming theyre writing.

If its not clear what I mean, here's a silly example:

I have one file called circles.fun, in it are individual routines for
finding the circumference, area, radius etc of a circle.

Then whenever you want to write a programme that needs some of those
calculations, you write a programme that calls circles.fun and uses the
routines within it. That way your programme only needs to worry about
prompting the user to input the value for the radius or whatever and then
displaying the answer - the circles.fun file is what actually performs the
calculations.

So all you need to do is write the function file, and document each function
and the variables that need to be passed into and, what it spews out at the
end.

I think this how #include works in C, but dont quote me on that!

Have I made sense?

Hamster


More information about the Programming mailing list