All of this advice is summed up in the following aphorism:
Remember that you write code for three audiences:
The computer, for which it must be correct
Your muse, for whom it must be elegant
The poor schmuck who has to modify it,
for whom it must be comprehensible
Dan Killoran