By "not adequate", I was not referring to the weight of comments.
Two things bother me. One is the apparent lack of evidence of a controlled
requirements->specification->design->code->test process. The other is the
long loop. I strive to keep all routines to a single page, or at most two
pages that can be viewed together. I will admit to having multi-page
switch/case structures when there was just no other way to get all the cases
written in.
A programming language and its processors are just an impedance
matching system between the way a person thinks and the way a machine
executes instructions. So different people will have preferred, and
more suitable, approaches to programming. I'm an engineer (I write
from sci.electronics.design) and I think in state machines, hardware
registers, and microseconds. So my preferences are...
If it's only used once, it shouldn't be a subroutine
Signals (and code) flow from top to bottom
The best control structure is a jump. That's all the CPU does.
It's easier to read if it's linear
Comment correctly and thoroughly. Be funny if you can.
Avoid abstraction at all cost. But structures are golden.
Program in assembly. C rots your mind.
You *must* archive the entire tool chain with the rest of
the project, as a formal release, if you hope to be able
to maintain it longterm.
Of course, this is embedded, bare-metal, hard realtime stuff, without
an os. Most of the work is done in smallish state machines that run at
interrupt level. I wouldn't want to write a web browser this way.
I had a psychology professor who had been in training research in
WWII. He was trying to improve the sorry performance of waist/tail
gunners in bombers. One day, just as "final exams" were about to
start, he grabbed the graduating class of the Cooks and Bakers School
and sent them up instead of the gunnery students. They shot better.
The best four programmers I personally know (I modestly include myself
at the bottom of the list) are two ee's, a chemist, and a PHD in
thermal hydraulics. None have taken any CS courses. Interesting.
John