The Art of R Programming

(WallPaper) #1

13


DEBUGGING


Programmers often find that they spend
more time debugging a program than
actually writing it. Good debugging skills
are invaluable. In this chapter, we’ll discuss
debugging in R.

13.1 Fundamental Principles of Debugging


Beware of bugs in the above code; I have only proved it correct,
not tried it.
—Donald Knuth, pioneer of computer science

Though debugging is an art rather than a science, it involves some fun-
damental principles. Here, we’ll look at some debugging best practices.

13.1.1 The Essence of Debugging: The Principle of Confirmation...........


As Pete Salzman and I said in our book on debugging,The Art of Debugging,
with GDB, DDD, and Eclipse(No Starch Press, 2008), the principle of confir-
mation is the essence of debugging.
Free download pdf