<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" xmlns:m="http://www.w3.org/1998/Math/MathML" id="Module.2004-05-25.2049">
	<name>Software Library</name>
	<metadata>
  <md:version>1.1</md:version>
  <md:created>2004/05/25 18:20:49 GMT-5</md:created>
  <md:revised>2004/05/27 13:18:05.025 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="adrianv">
      <md:firstname>adrian</md:firstname>
      
      <md:surname>valenzuela</md:surname>
      <md:email>adrianv@rice.edu</md:email>
    </md:author>
      <md:author id="seejaie">
      <md:firstname>CJ</md:firstname>
      
      <md:surname>Ganier</md:surname>
      <md:email>seejaie@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="adrianv">
      <md:firstname>adrian</md:firstname>
      
      <md:surname>valenzuela</md:surname>
      <md:email>adrianv@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="seejaie">
      <md:firstname>CJ</md:firstname>
      
      <md:surname>Ganier</md:surname>
      <md:email>seejaie@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>library</md:keyword>
  </md:keywordlist>

  <md:abstract>A software library is a set of software functions used by an application program. </md:abstract>
</metadata>
	<content>
		<section id="s1"><name>What is a software library?</name>
			<para id="p1">
       	By now, you have probably written some C, so you should probably be familiar with the idea of writing helper functions.   In many respects any function you call from inside the main() function is a helper to main.   However, in general, a helper function is a function that isn't meant to be called from outside the file its in; instead, it helps by allowing the programmer to break larger functions into manageable bites and to control code you need to repeat from a single place in the file.  A helper function is generally intended to be called from a specific file or function in the program, and it may contain specific details useful only to a certain situation.  Another rule of thumb is that a helper function should not be included in the header file of a program. 
     </para>
			<para id="p2">
Other functions are meant to be called from anywhere in the program or to be called by any arbitrary program that cares to use them.  For organizational purposes, it is a good idea to sort these functions into groups related by the purpose of the functions.  A group of functions so grouped by purpose is generally called a library.  A similar concept is the "<term>application program interface</term>" or API.  This is generally the name given to libraries published by the makers of a programming language, operating system, or large programming utility.  The API libraries are called interfaces because only the method headers are provided instead of the entire source code.  Providing the source code to an interface would allow the user to modify the library or to exploit the specific way it was programmed.  The advantage of only providing the headers is that it allows the maintainer of the operating system, language, or utility to update the API more easily without breaking a customer's existing code.  
      </para><para id="p3">
For an example of a good API specification you can visit <link src="http://java.sun.com/">http://java.sun.com/</link> or <link src="http://java.sun.com/j2se/1.3/docs/api/index.html">http://java.sun.com/j2se/1.3/docs/api/index.html</link> and follow the links to the specifications of the java language library. What you will see is a reference to various libraries of interfaces.  Each interface comes with a list of functions.  Each function's behavior is explained along with the parameters and return value.  Similar library definitions can be found for C in guides to the C programming language. 
    </para></section>
	</content>
</document>
