Next: Modules
Up: The Building Blocks of
Previous: Subroutines
  Contents
Procedures for most common programming tasks have already been written and
are available for us to use (many times for free!).
One example is the set of intrinsic functions in F95.
Another example are the standard libraries for numerical computations.
BLAS (Basic Linear Algebra Subroutines) is a collection of
modules that perform matrix and vector calculations.
LAPACK is a complete set of subroutines for solving numerical
linear algebra problems.
Any time we have a programming task, and need to write a piece of code, it is
advisable to check whether a standard subroutine, in a standard collection,
performs the same task for us. This cuts down programming time;
cuts down the likelihood of programming errors;
usually, enhances performance; and, of course,
enhances software maintainability.
If we are to write our own procedures from scratch,
here is some expert (and free!) advice, from A.C. Marshall:
- keep the procedures under 50 lines long, for a simple
control structure;
- make procedures as flexible as possible, to allow for software reuse;
- pass as many variables as possible as actual arguments, and
rely as little as possible on global storage or host association;
- give procedures meaningful names, and plenty of comments;
- there is absolutely no point in reinventing the wheel -
use standard libraries whenever they offer subroutines
which solve the required task.
Next: Modules
Up: The Building Blocks of
Previous: Subroutines
  Contents
Adrian Sandu
2001-08-26