11.11 Debugging

It is very easy to make a blanket statement that we should always use a computer to perform menial and repetitive tasks because the computer will make fewer stupid mistakes. However, this conveniently ignores the fact that the computer has to be told, by a person, to do the right thing.

Writing a script to tell a computer how to do a task is just another opportunity to make a mistake. Also, while we only have to write one script, rather than perform a menial task a thousand times, writing a script is a much more complex task and so the chance of making a mistake is higher. Even worse, the consequences of getting it wrong are greater. If our script contains a mistake, we could massacre our entire data set.

The silver lining is that, if we get the script wrong, as long as we notice the mistake and can fix it, it is trivial to repeat the data processing to fix it up.

The important thing is that we must acknowledge that there is a chance that a script will contain mistakes. We must not assume that our script will work; we should always check the results of a script (testing); and we must be capable of determining the source of any errors (debugging).

Paul Murrell

Creative Commons License
This document is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.