3 ms·
I found the Alice in Wonderland image at http://www.linusakesson.net/programming/syntaxhighlighting/ http://www.linusakesson.net/programming/syntaxhighlighting/
by callahad 11y ago
I found the Alice in Wonderland image at http://www.linusakesson.net/programming/syntaxhighlighting/ http://www.linusakesson.net/programming/syntaxhighlighting/ particularly compelling, in support of the argument that highlighting may emphasize syntax at the cost of obscuring semantics.
- jasode 11y agoI've not found that Alice analogy colorizing the "verbs" convincing. With human language like English, we learn it and use it without the formal grammar++. A 5-year old child can speak to her mother ("I want some candy!") without conscious knowledge of "verbs" or "nouns". A formal grammar for categorization is what we layer on top of language for analysis in school. Two people can communicate and understand each other without any exposure to any grammar lessons. So yes, colorizing verbs looks superfluous and noisy.[2] On the other hand, computer programming syntax starts with grammar. You learn that certain specific tokens are "data types" and other tokens are "literals", etc, etc. And that grammar categorization in programming languages never goes away as you're typing out new code. (Otherwise, you'd get a compiler error or unintended behavior because x="3"+"5" with quotes ("35") means something different from x=3+5 without quotes (8).) This is why so many programmers find color highlighting helpful even if they've been programming that language for 10+ years. Sure we want to focus on higher cognitive purpose of "semantics" but the grammar is deeply intertwined with reconstructing what the semantics is. A closer analogy of color highlighting in a different realm would be different colors in TCPIP traces such as "red" highlighting external ip addresses. This can be helpful for forensics of malware phoning home. Or in financials dashboards where uptrends are "green" and downtrends are "red". The same reasons that colors help the malware analyst or stock trader quickly parse data at a glance is also how it helps programmers. ++ (at least not consciously that a 5-year old would be self-aware of it. A theory of innate universal grammar in the brain by Chomsky isn't what I'm talking about.) [2] except for rare examples of using annotation or coloring of verbs to help parse sentences like this: https://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo https://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffal...
- icebraining 11y agoAs the author himself points out (though after making an argument that implies the opposite), code is not prose. Prose has its own base elements, such as phrases and titles, and it does use visual cues to point them out, such as capitalization and larger fonts.
- Grue3 11y agoThe main problem is garish colors. If colors were a bit more subdued, the text would've been just as easy to read. That applies to code as well: bright red letters on black background are extremely distracting, dark purple letters on white background are not at all distracting.