I want to thank folks for their thoughtful comments.
I clarified a few design points.
Most importantly, I added four new appendices. For Python programmers, I provided examples of unittest, doctest and epydoc. For Java programmers, I provided examples of JUnit and javadoc.