Dan makes an
interesting observation about syntax highlighting:
I noticed this the other day when I printed out the code for the compiler
module I’m working on. In the editor, with colored highlighting enabled, it
makes sense what’s going on, and everything’s reasonably obvious. On paper,
though, in black and white with no highlighting the lack of comments was much
more obvious, and the code itself didn’t make a whole lot of sense.
I have certainly made the same observation. Once in a while, I revert
to emacs to edit Java files and the absence of highlighting immediately puts an
extra burden on my eyes and my brain (and yes, I know about syntax highlighting
in emacs, I actually wrote a few elisp modes myself, but I stopped trying to
install such packages about five years ago when my sanity was on the brink of
However, I don’t follow Dan when he says:
I have noticed one interesting thing about using it [syntax highlighting],
though–I comment my code less.
I fail to see the logical connection between syntax highlighting ("read"
mode) and comments ("write" mode). Syntax highlighting is certainly not a
substitute for commenting your code.
Syntax highlighting is about… well, syntax: keywords, expressions,
Comments are about semantics. You don’t need to explain what a "for"
loop does, but it’s definitely a good practice to put a comment on top of such a
loop to explain the business logic inside. Syntax highlighting certainly
doesn’t cover this aspect, so don’t be lazy with your comments.