By this point you will have used and modified many of the example programs described earlier, and you will have written programs of your own. The problem of what to do when your program does not behave as expected is now relevant. Problems with programs are known as “bugs”, and the process of removing bugs from programs is known as “debugging”. We believe that a convenient approach to programming is what could be described as “preventative programming”. To paraphrase an old proverb, an ounce of careful programming is worth a pound of debugging. In this chapter we shall attempt to describe some techniques for debugging, but we shall start with a discussion of how to try to prevent bugs from infesting your programs. We realise that such a problem is unsolved in general, but we simply wish to convey some informal techniques that have helped other Prolog programmers.
Unable to display preview. Download preview PDF.