[Sussex] Code-writing methods
Neil Hart
neil.m.hart at googlemail.com
Thu Nov 16 16:43:24 UTC 2006
Hi
Commenting your code is a vitally important thing to do. However, any
programmer will tell you that, when the pressure is on, comments are
the first thing to suffer.
The approach I used to use (when I was writing code for a living) was
to write "self commenting code". Take the following simple example
that has NO comments whatsoever:
if( nCurrentTemperature > DANGERLEVEL )
{
nAlarm = ON;
nEmergancyShutdown = ON;
logmessage(MAXTEMPEXCEEDED);
}
Any non-programmer, or someone not familiar with the language syntax
will immediately see what is going on in the code. The penalty for
such an approach is unusually long variable names and lots of
#defines, but in my view, this is not a big price to pay.
Whatever you do, it's your code and you'll end up with your own style.
Just my 2p's worth.
:-)
Neil
More information about the Sussex
mailing list