in reply to Preferred method of documentation?
My rule for documentation is that I should be able to look over the code in a few years and see easily what the code does and whether all or parts of it is useful to any task at hand.
This leads me to a style similar to that of documenting new projects in sections:
- Purpose: Summary of what the script does and why
- Scope: Who is this for? Developers? Users? How much of whatever task is assumed versus handled?
- Input and output requirements: XML input?
- Dependencies: external programs, file formats, databases, embedded references to paths, etc.
- Usage: How should I execute it?
- Change history: This is more for keeping track of updates and debugging purposes but can be very helpful, especially so if more than one developer edits the script. This might be part of CVS or could be at the top of the script. An example:
# 08/26/04 BW Changed doAssemblyJobs to read bait from file versus DB # 08/25/04 BW Added indexing and formatdb of gss files. # 08/17/04 BW Moved logic of buildMSH.pl into this script
# Generic job monitor for watching jobs finish. # - No action is taken when each job finishes. # - Function returns when all jobs have finished. # - Inputs: A hash of job IDs from LSF # - Returns: No specified return code
One thing I try to remember is that while things may seem obvious while writing and testing the code, a year or so in the future they won't be. Commenting with that in mind has helped me out in many situations.
|
---|
In Section
Meditations