TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Subject:Re: Documenting Code/Why Is It So Ugly? From:Rebecca Merck <Rebecca -dot- Merck -at- ONESOFT -dot- COM> Date:Tue, 2 Mar 1999 14:33:58 -0500
The really great news is that for most programming languages, the
spacing is absolutely irrelevant.
You
could
put
one
word
on
a
line
and the compiler doesn't care. You could put 1000 words on a single
line and the compiler doesn't care.
*NOTE*: Double-check this with your programmer before you go monkeying
with your copy of the code, just to be sure that it's true for their
language.
So you can usually use your discretion in terms of where to break the
lines of code, and how to indent and space around broken lines, to make
it clear that they go together. Just as long as you don't make a change
that renders the code uncompilable, you should be fine.
ABSOLUTELY I agree with Ben on font choice: use a monospace font. Very
important to the programmers. They're accustomed to seeing code in
courier, and it's confusing to them to get a proportional font. Mine
nearly strangled me when I suggested a font change. However, in a book
where the standard text is a serifed font, to have the code in another
serifed font looks funny. I downloaded Andale Mono from the Microsoft
site -- it's a sans serif monospace font, and it's what I'm using for
our code examples, since we use Garamond for the standard body text. It
looks really good, and our programmers were happy with it.
Another thing I've been doing is to put a grey background behind the
code, to really set it apart.
Ben, btw -- I printed out the reference to your book, and I can't wait
to take a look at it!