Code That Makes Decisions

A smart procedure performs tests on its environment and then decides what to do next based on the results of each test. For example, suppose you've written a Function procedure that uses one of its arguments as a divisor in a formula. You should test the argument before using it in the formula to make sure that it isn't 0 (to avoid producing a "Division by zero" error). If it is, you could then display a message that alerts the user of the illegal argument.

Similarly, a well-designed application will interact with the user and ask for feedback in the form of extra information or a confirmation of a requested action. The program can then take this feedback and redirect itself accordingly.

0 0

Post a comment