Computer programming remains a challenge for many people. In recent years,
this has led to the popularity of software applications with graphical user interfaces,
which circumvent the need to program. Yet programming remains an indispensable tool in research and other specialized
applications.
In many instances, debugging a computer program requires uncommon ability. However, a debugging trick that never fails is to
print intermediate steps until the source of the trouble is identified.
In the early 1980's, a student came to me with a partially completed programming assignment, and said:
"Prof. Ponce, I have been looking at this program for more than two hours and cannot find the bug. Can you help?"
I answered: "You need to not just look at the code; you need to do something about it."
And then, I proceeded to reveal to the student a trick that I had learned during my graduate school days at Colorado State University.
"Place the message 'So far so good!' in several critical parts of your code, and pretty soon you will find where the problem is".
The student followed my advice and in very short order was on his way to completing the assignment.
| ||
|