3 ms·
The best highlighting is no highlighting at all. Think about it. You've read that the best programs read like a book. Now picture a book you are reading where
by icantthinkofone 12y ago
The best highlighting is no highlighting at all. Think about it.
You've read that the best programs read like a book. Now picture a book you are reading where the title, subject, nouns and verbs were all colored in some way. Try and read smoothly through that forest and think about highlighting some more.
There are a number of articles about reading on the web and how you highlight links without interrupting the flow of the reader. Should you underline links, or make the word a different color or give it a background? No matter what is done, it's said, you will interrupt the reader's flow and train of thought. Here, though, people exclaim highlighting is beneficial because function names, variables, values, and so on are highlighted and this is good!
Now someone will claim highlighting helps them find a particular value, say a function name but isn't that what indenting is supposed to do? Others will now say it helps with arguments but isn't that parentheses are for?
If you look at most multi-colored, highlighted page of code it looks like a candy store, all of it begging for your attention which is exactly what you don't want. Those with muted colors and grays are no different when you're trying to pick out one slight variation over another and trying to determine if it's a function or something else.
When I read a book, I want paragraphs with indentation and I can read pretty fast that way. So can you. When you read code, you need blocks and indentation (and parenthese/brackets/semicolons). Little else. Maybe nothing else.
- qu4z-2 12y agoI like to think of syntax highlighting as a quick draft-parse. It lets you know how the computer is parsing the code structure. I know, "Code is written for humans to read and only incidentally for computers to execute", but you'd be quite put out if the computer didn't execute your code. If human languages were written for one more-or-less uniform reader, I'd love a feature that showed how people would resolve pronouns ("Mary gave Sue her laptop.") or ambiguous attachment in general. Granted that's semantic, and probably closer to the feature in some editors where other instances of the same variable are highlighted on hovering, but they are both a form of visual feedback as to how the input token stream will be interpreted. I'd also say it's more important to get that information with a computer, because humans are pretty good at error recovery, and can often resolve syntax errors at the semantic level ("This sentence doesn't make sense; presumably it's a typo and <x> was meant, because that makes sense in context.") In fairness, I dislike most highlighting schemes, but they definitely have a certain value.