Topic: The Programming Process
February 11,
2016
The Programming Process:
Be sure of your algorithm before you start writing code. Write the pseudocode and check it.
Start with a "Hello World" program, and always maintain a running, testable program during development.
Only add a few lines of code at a time, running the program to test whether those added lines of code added proper functionality.
Carefully modularize the program according to the natural divisions of the algorithm. Each module should have a well defined purpose.
Add Data Protection code (see below) as you program to make sure the modules are as independent and "bullet-proof" as possible.
Add debug code at the beginning and end of modules, tracing the flow of execution through the various modules
and displaying the values coming into the modules and any values returned.
Add debug code outputting the value of important variables at strategic locations in the code,
tracing how the values change as the program executes.
Example: The process we used to develop the Prime algorithm in class.
Data Protection:
Adding code to prevent data variables from having inappropriate values for the fulfilment of the algorithm's purpose.
All input variables should be checked for suitable values.
As variables are passed between program modules, they should be checked for appropriate values.
Example: Protective IF statements