Things to Remember... - The code should be modular, - procedures and functions should be used. Library modules should be ‘closed’ so that the variables used in them cannot disturb the code of the rest of the program.
- Meaningful variable names should be used.
- There should be internal commentary, explaining what each section of the code does. Where a complex algorithm has been implemented, it is helpful to comment on several lines of the code, in addition to a general description of what the module does.
Things to Remember (2) - Where parameters are being used in a module, they should be described in the commentary of the module. This is particularly important in library modules.
- Parameter lists should be small and manageable. If a procedure or function requires a set of parameters which is very big, then it is likely that it is performing more than one program function. The original design needs to be revisited, and functionally decomposed.
Debugging the Solution - which is simply a formatted display or printout of the code. It is important that the code is written in such a way that helps the above activities.
Dry Runs - To complete a dry run the programmer works through a section of program code by hand. This is very useful for locating errors in both syntax and semantics.
- A trace table will normally be used in this activity.
Trace Tables - A trace table is constructed with a column to identify the instruction executed and a column for each variable.
- The programmer works through each line of the listing changing the appropriate variables.
Test Data - 1. “normal” operation of the software, to make sure that there are no unexpected results in ordinary work.
- 2. the operation limits of the software, to make sure that the boundary conditions identified in the design stage are being handled properly.
- 3. “exceptions” to the normal operating conditions. This set will show whether or not the software can react to unexpected inputs in an effective way, without crashing.
- The expected results from a test data set must be known in advance, so that they can be checked against the actual results. You should include test data to demonstrate the following:
Do'stlaringiz bilan baham: |