UMBC CS 201, Fall 05
The three most important concepts in Computer science: Modularity,
Functions provide a way to divide your program up into managable
Libraries group functions into larger modules.
Why is it usually a good idea to break a large program into smaller
A more general question is how to make functions that you have written
available to other programmers.
Typically we provide the compiled version of our functions and an interface.
- Managing complexity.
- An additonal advantage of doing this is that compilation time is
reduced during the development process because you only recompile the
code that you changed, instead of the whole program.
An interface is a file that contains
information that a user need to know in order to use the functions in the
library. It must be a very well commented file.
The interface of a function is simple:
If the code truly represents a function, then this is all you need to
know to use it.
- it's name
- the type of the result it returns
- the number and types of its parameters
- "what it does" -- i.e. how output the result is computed from the input
Think of a library as a collection of functions. Some of the
functions are written to be used by others and some are internal ones
which have been written to support the others.
We say that the functions which are intended to be used by others are
exported by the library.
What does the user of a library have to know?
The names of the functions
Hmmm .... sounds like some well commented function prototypes ...
What they do
The kinds, types and order of the arguments
What type is being returned
Sunday, 21-Aug-2005 09:53:51 EDT