Errors 101
All good languages contain procedures for error checking and handling. For example, Visual Basic contains the MaskEdit control and the OnError GOTO approach. Both Java and C++ contain approaches for exception handling. These language also incorporate debugger routines.
The best approach, however, is to follow good code writing practices and techniques. Some of these are summarized below.
Write code in small modules - not all at once.
Modularize the code - the main should orchestrate only.
Place all work in the methods.
Run the code in small modules as it is developed.
Use stub programming - write the modules, check them, then fill in the blanks.
Write, at strategic locations, the values being calculated.
Benchmark the code - run it with known data and results.