PureBytes Links
Trading Reference Links
|
Gary Fritz <fritz@xxxxxxxx> writes:
>I **HATE** reading code that's full of meaningless variable names
>like [Value1, Value2 etc.]...
>
>Comments are also CRITICAL for any code over about 10-20 lines,
>especially if you want anybody else to understand it (or if you want
>to understand it yourself next month!!). Explain what's going on,
>why you did such-and-so, etc. Maybe the code you write is totally
>clear to you at the moment you write it, but it's probably not
>totally clear to anybody else.
We used to say that certain people produce write-only code.
Their projects sometimes got up and running quickly, but
always seemed to be plagued by mysterious failures.
John Fogelin, the chief techie at Wind River Systems, once
remarked that if you could just get all the variable names
and function names properly defined, you were 90% of the
way to a working system, and I have to agree. It's worth
taking that time up front to think things through.
Back when peer code reviews were just coming into fashion in
the software industry, I asked a lecturer what advice he'd give
to an individual programmer working without a peer group. He
said his technique was to set his code aside, for as long as
he could afford, then pick it back up and review it himself.
I guarantee that all those comments and well-thought-out names
will pay for themselves many times over in your review.
Jim
|