[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: What is good programming practice in Stata?

From   Joachim Landström <>
To   <>
Subject   st: What is good programming practice in Stata?
Date   Thu, 19 Nov 2009 11:31:19 +0100

I have been browsing around on Internet trying to find any suggestions about
good programming practice in Stata and have failed to do so. Thus I pose
this question.

When I have a look at ados, it does seem to me that good programming
practice in Stata amounts to:
#1 Do not use either Pascal casing (MyVar) nor Camel casing (myVar) for
variables and parameters, just stick to small caps.
#2 Do not use meaningful and descriptive words to name variables
#3 Use as much of single character variables as you like and surely do not
comment on what they are
#4 Do not bother to use method names that dissimilar to existing functions
(i.e., display versus Display)
#5 Do not separate logical groups of code
#6 There is no consensus about numbers of blank lines between different
methods in an ado-file.
#7 Do no use single spaces before and after operators and brackets.
#8 By all means use as much of abbreviations as possible

Well I could continue but the more I write I feel that it rather becomes a
list of bad programming practice. 

If we have a look at good programming "code of conduct" in e.g., C++ or Java
we see extensive use of different types of casing separating classes,
methods, variables and parameters. Variables are given descriptive words,
commenting is sparse and largely unnecessary since descriptive words are
used and abbreviations are avoided as are single character variables. Single
spaces are used both before and after operators and brackets. 

I could go on on this issue but being rather fresh as a Stata user my
empirical sample of ados may be biased and that is why I raise this

What is Good Stata Programming Practice?


*   For searches and help try:

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