Program Errors

It is important that software always works correctly. Some programs may seem to perform well for years then a particular piece of data may cause an error to occur! Programs can generally not be tested completely but enough tests can be performed to give us reasonable confidence that it works.

Subroutines should be tested individually. A 'test harness' - a program which tests the modules can be coded and run. Once tested, the subroutine may then be confidently used in many programs.

Errors may be

syntax errors Using the syntax of the language incorrectly
  eg Spelling mistake such as prunt(message);
  or  
  assigning data of the wrong type to a variable.
    Surname = 12.5
logical errors The program compiles successfully but does not perform correctly.
  eg TotalAmount = Amount + Discount
    instead of
    TotalAmount = Amount - Discount

Compile-time (Translation) errors occur when the program is being compiled (usually syntax errors).

Run-time (Execution) errors occur when the program is being run (usually logical errors).