Next: References
Up: Some Notes on
Previous: Optimization
Below is a summary of the various issues raised in the previous
sections. Compare your program to this list.
- 1.
- Divide your program in subroutines and functions: output,
boundary conditions, initial condition, exact solution, etcetera.
- 2.
- Use the correct type subprogram.
- 3.
- Keep your subprograms in separate files.
- 4.
- Share subprograms.
- 5.
- Use subdirectories to organize your files.
- 6.
- Use makefiles.
- 7.
- Put a comment block at the start of each program and subprogram
to explain its function, how to use it, limitations, and when and
by whom written.
- 8.
- Declare the type of each variable and describe it clearly.
Pay particular attention to the arguments of a subroutine.
- 9.
- Use blank lines for clarity.
- 10.
- Describe the individual parts of a program or subprogram using comment
blocks.
- 11.
- Use comment statements to ensure that the purpose of each individual
line of source code is clear.
- 12.
- Choose clear, concise, and consistent variable names.
- 13.
- Use implicit none.
- 14.
- Express array bounds as parameters, not numbers.
- 15.
- Do not store all time levels in a transient problem.
- 16.
- Do not hardcode the values of parameters as numbers. Read them from
an input file.
- 17.
- Ensure that the input file is understandable and has a meaningful name.
- 18.
- Check any number that you read in thoroughly.
- 19.
- Print clear prompts when you read from the keyboard.
- 20.
- Avoid program crashes when you read in from the keyboard.
- 21.
- Every character in the output file must have a real value.
Select the number of digits to output wisely.
- 22.
- Do not write pages of numbers to the output file. Output
processed data that show the important features at a glance.
- 23.
- Check pointwise values using graphs.
Next: References
Up: Some Notes on
Previous: Optimization