Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Documenting ssc contributions: efficiency for Man and machine


From   Allan Reese <[email protected]>
To   Stata distribution list <[email protected]>
Subject   st: Documenting ssc contributions: efficiency for Man and machine
Date   Mon, 19 Jan 2004 15:05:33 +0000 (GMT)

It was recently reported on this list that Bill Gould thinks that programs
should not need comments.  I disagree; it's often hard to remember why a
particular line/variable/condition was needed when reading code written
some months back.  Too much computing (eg APL, web-authoring, anything by
** Corp) is write-only code.

On the other hand, for an interpreted language there may be a noticeable
hit on performance if comments are included in, say, an inner loop.

I'm on the verge of contributing to SSC, and thought it would be
worthwhile packaging two versions of the main routine.  The *.ado file
should be stripped down to plain code and all comments removed.  The
second version is the same code but with all the development comments
revised and expanded, to be readable.  This is a nod towards the advice of
Don Knuth (quoting informally from memory), that a program should have the
form of paragraphs with an introduction for humans and then code for
execution.

One question is whether other people do this, and if there is any
convention for the extension code for documented code: if not, .doc or
.com are possible but clash with other uses; .CDO could suggest Commented
DO.

R. Allan Reese                       Email:     [email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index