1.3.1 Desk Checking an Algorithm

Desk checking is a manual process. 

  • As the name suggests it is carried out using pen and paper sitting, presumably, at a desk. 
  • Each statement in the algorithm is evaluated by hand and the results written on a table. 
  • The table contains a column for each identifier used within the algorithm. 
  • As the value in an identifier changes the new value is written beneath the previous value. 
  • In this way, a full record of all the changes that have occurred is maintained. 

Usually values altered within a single iteration are written on a single row. 

  • This assists reading back through the table should an error occur. 
  • Often a repetition will contain a large number of iterations, this can become tedious. 
  • It is acceptable to detail the first few iterations and then skip forward to consider the last few iterations as in the large majority of cases errors will occur at the start or end of loops. 
  • A horizontal line is drawn once the end of the algorithm is reached and prior to the next set of test data being applied to a new desk check.

Data types such as arrays and records require special consideration. 

  • The elements of an array can be given their own column if this is practical. 
  • It is also possible to have a column for the array index beside the array’s identifier column. 
  • This technique makes it possible to determine which element of the array is being accessed, however it is difficult to see the changes occurring to particular elements.

Each record requires a separate column for each of its fields. This can become tedious when a number of records with a number of fields are being used. It is acceptable to just detail the values held in the fields relevant to the processing occurring. For example, the desk check of an algorithm that calculates statistics based on employees sick days need not detail the employee’s name, phone number or other details, rather
it can just detail the field containing each employee’s number of sick days.



Comments