News for hackers. Stuff that matters.
Re::syntax Off by haberman on Monday November 05, 2012 @02:28AM (#4742598)
If you follow this reasoning I think you'd also have to shun line breaks and indentation. After all, natural language doesn't put each sentence on a separate line, or indent clauses. It flows in uninterrupted prose with paragraph breaks being the only distinguishing horizontal or vertical formatting.

Clean code is all about structure. Anything that help show structure, symmetry, hierarchy, or other patterns is bringing your reader one step closer to understanding. The difference between a keyword and an identifier is part of the program's structure. Coloring it makes it visual.

Also, properly-implemented syntax highlighting is essentially a very short feedback loop with the compiler that shows you how your code is actually being parsed. Short feedback loops make creativity easier (this is the basis of a lot of Bret Victor's work).

I agree with the author that "paying attention to what the code is doing instead of the individual elements" is important, but I don't think you have to turn off syntax highlighting to achieve this. At least I don't personally. If the colors are distracting, one idea might be to make them more muted so that they don't demand as much attention. But to me there's no going back from being able to see visually that you forgot to close a string or parenthesis, or include a proper line continuation for your macro.

Re::syntax Off by evoxed on Monday November 05, 2012 @04:21AM (#4742814)
> If you follow this reasoning I think you'd also have to shun line breaks and indentation.

Not quite. As I'm sure you know, written languages have evolved over time in order to meet the needs of readers and writers alike. That includes capital/lowercase, roman style (i.e. non-script) lettering, spaces, leading and paragraph indentation (thanks to printers), etc. It isn't helpful to blindly latch on to seemingly cute analogies, but in this case I think it's a pretty fair comparison. I imagine others who don't use highlighting all the time would agree that it's a happy or at least comfortable middle ground. I'm a little sleepy-eyed now and shouldn't still be typing, so sorry if my tone reflects negatively. I think the response below (corwinstephen) brings up the same thing, except if you like highlighting then your middle ground leans further towards an explicit, notated style.

Re::syntax Off by bmj on Monday November 05, 2012 @06:59AM (#4743088)
Further, if you write a list of instructions (say, a recipe), you will likely follow a convention that puts each instruction on a separate line, and might make use of indentation to further delineate sub-instructions.
Re::syntax Off by joesb on Monday November 05, 2012 @06:59AM (#4743089)
> ... capital/lowercase, roman style (i.e. non-script) lettering, spaces ...

I think this are poor man's syntax hi-lighting. Or at least physical world implementation of syntax hi-lighting. After all, you don't want to carry a lots of colors pen in order to write.

But if computer can do it for us, why not?

Re::syntax Off by corwinstephen on Monday November 05, 2012 @03:21AM (#4742704)
Agreed. Plus, I think he's way off base when he says that syntax highlighting is equivalent to emphasizing certain parts of speech in traditional prose. It's not. The prose equivalent of not including syntax highliting would be not including and paragraphs, capital letters, commas, apostrophes, periods, bold, italics, or underlines. You're left with something that contains the same information, but is harder to understand.

Also, it bugs me when people try to compare code and prose. Just because they're both typed as text using keys on a keyboard doesn't mean they're in any way related. Calling them analogous is like trying to compare building a house and buying a car. Yeah, they're both life investments, but that doesn't mean you use any of the same strategies between them. Money aside, they're unrelated.

Re::syntax Off by eru on Monday November 05, 2012 @09:38AM (#4743598)
> After all, natural language doesn't put each sentence on a separate line, or indent clauses. It flows in uninterrupted prose with paragraph breaks being the only distinguishing horizontal or vertical formatting.

Code is closer to poetry than prose. Line breaks and stanzas are very important, there.