TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A case against syntax highlighting (2007)

25 pointsby svenfawover 3 years ago

39 comments

runawayover 3 years ago
This hardly makes a case at all. Only one section in the middle is actually dedicated to why syntax highlight is bad and it boils down to a baseless assertion about &quot;biasing&quot; the developer&#x27;s mind toward syntax. I would counter that assisting developers in thinking about how code will be interpreted or compiled rather than bytes of text is closer to the semantic meaning than without.<p>There&#x27;s also a comparison to highlight syntax in fiction, which is absurd for many reasons. A simple one being that the _goal_ of fiction can often be to obscure meaning for the sake of ambiguity. I&#x27;m offended not by the thesis but by the presumptuous nature of the argument.
评论 #28494752 未加载
claudiawernerover 3 years ago
I have a strange use case for syntax highlighting: If you ever forget to close a string or a function definition argument list, or anything along those lines, the following text will not be colored as usual. This is also why I have automatic indentation enabled, if the indent is put in the wrong place, I know I made a syntax error further up.<p>In many (most?) languages, you can look at where your code stops being colored and see you forgot to close something like a comment or a paren.
评论 #28494898 未加载
评论 #28494010 未加载
评论 #28495942 未加载
评论 #28494430 未加载
kazinatorover 3 years ago
Case against indentation!<p><pre><code> Alice was not a bit hurt, and she jumped up on to her feet in a moment: she looked up, but it was all dark overhead; before her was another long passage, and the White Rabbit was still in sight, hurrying down it. </code></pre> I mean, just <i>look</i> at it. Would you read a whole book like this? You can&#x27;t see the semantics for all the obsession with syntax.<p>Case against multi-file projects! Would you read a book if you had to go back to a Makefile or other project artifact to figure out where the next chapter is? Come on, put the whole damn program in one file that reads from top to bottom!<p>Case against local variables:<p><pre><code> but let P = &quot;another long passage&quot; it was all dark overhead; before her was P, and the White Rabbit was still in sight, hurrying down P </code></pre> This is now totally unnatural &quot;STEM speak&quot;. Use the good old ambigous anaphoric pronouns, or GTFO!
评论 #28495686 未加载
评论 #28499084 未加载
quocanhover 3 years ago
This article is very interesting. I recommend everyone who reads this to try and dissect what makes a wrong argument sound convincing.<p>A ton of terrible arguments are made here: X is important so Y is not important. ABC is a sacred rule that must be followed without question and doing XYZ does not follow the sacred rule. Wrong thing is done to help dumb people so smart people shouldn&#x27;t do wrong thing.
评论 #28499038 未加载
评论 #28498600 未加载
评论 #28494851 未加载
ziotom78over 3 years ago
I started programming the C64, then moved to Turbo Pascal 3 for DOS, then Turbo Pascal 6. None of these environments provided syntax highlighting. Then came Borland Pascal 7, with syntax highlighting... And, boy, I was mesmerized!<p>I really cannot think of going back to plain two-color editors like TP3. Syntax highlighting helps me to spot unterminated strings, mistaken variable names that clash with keywords, plus the general &quot;feeling&quot; of a page of code that I get when I quickly scroll a long source file in search of a specific place.<p>I do not think that syntax highlighting has spread everywhere just because it looks cool. It is SOOO useful!
评论 #28494098 未加载
dangover 3 years ago
Some past threads:<p><i>A case against syntax highlighting (2007)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11857006" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11857006</a> - June 2016 (77 comments)<p><i>A case against syntax highlighting (2007)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8606065" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8606065</a> - Nov 2014 (2 comments)<p><i>A case against syntax highlighting</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8262192" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8262192</a> - Sept 2014 (3 comments)<p><i>A case against syntax highlighting (2007)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7445455" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7445455</a> - March 2014 (1 comment)<p><i>A case against syntax highlighting</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=3717303" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=3717303</a> - March 2012 (24 comments)<p><i>A case against syntax highlighting</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=253114" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=253114</a> - July 2008 (1 comment)
NiceWayToDoITover 3 years ago
Syntax highlighting is more than the article is mentioning, it seems author comment is focused on old highlighters. Once when you get used to one theme brain is not even noticing, unless as shown in example colors are highly offending to aesthetic (the one in the article is hurting my brain). In modern editors as VSCode there is a huge range of adjustments. Nowadays we can do more than just see what are commands, keywords, increments ... we can see unused variables&#x2F;import, mistyped variable, see bracket that are not closed, comments, etc.<p>With syntax highlighters can be applied same rule as with UI, pleasing interface make it more usable. <a href="https:&#x2F;&#x2F;www.nngroup.com&#x2F;articles&#x2F;aesthetic-usability-effect&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.nngroup.com&#x2F;articles&#x2F;aesthetic-usability-effect&#x2F;</a>
mjw1007over 3 years ago
Independently of anything else, I find the additional distinctiveness created by syntax highlighting helpful for keeping my place, or recognising where I am, if I scroll around a file quickly.
SkipperCatover 3 years ago
Why on earth would you give up one of the most powerful tools in your IDE? Syntax highlighting speeds up readability, helps write correct code and IMHO, it makes code look pretty.<p>Color differentials are also a powerful human visual cue. This is why traffic lights are three distinct colors instead of just a top, middle and bottom light.<p>As to the comparison to prose, well, we have tons of syntax highlighting there too. Capitals at the beginning of sentences. Indentation and spacing between paragraphs, etc.
评论 #28495547 未加载
jpeloquinover 3 years ago
If your IDE didn&#x27;t use color to indicate syntax, would you want different information conveyed through color-coding? Using color to indicate syntax, which is already directly visible in the code you&#x27;re reading, does seem like sort of a waste if it could be used to convey more useful information.<p>Using different colors for sync vs async calls could be helpful. Or pure vs. impure. Or how many times a function or variable definition is used elsewhere in the code base, exercised in tests, referenced in the documentation, etc. I think I would find this sort of non-local information more useful than syntax highlighting.<p>There was a blog post linked here a couple weeks ago that used color shading to distinguish levels of nested parentheses, with color shift on mouseover, which was interesting.<p>The article suggests marking &quot;=&quot; and &quot;==&quot; in different colors, which doesn&#x27;t seem very useful unless the font shows adjacent = characters with no space between them.
评论 #28497931 未加载
pjmlpover 3 years ago
When I started into computers syntax highlight wasn&#x27;t even a thing, hence why certain languages use uppercase keywords as way to marking them.<p>For me syntax highlighting hate is nothing more than luddism.
评论 #28494302 未加载
评论 #28494244 未加载
评论 #28494078 未加载
ladbergover 3 years ago
I&#x27;d have to add coloring strings and language keywords to the list of exceptions before trying this. Strings are (imo) an obvious necessity, but I can&#x27;t tell you how many times I&#x27;ve stopped myself from naming a variable a reserved keyword because it showed up visibly differently when typing it out.
评论 #28494135 未加载
评论 #28494735 未加载
solmagover 3 years ago
I have semantic highlighting setup for Rust and I wouldn&#x27;t give it up. Just way too comfy.<p>&quot;moves focus from content to form&quot;, if data drives your code structure, especially easy with functional langs, these two start to become isomorphic.
评论 #28493906 未加载
simion314over 3 years ago
Most of the help I get in my IDE for JS are<p>1 helps with typos , I will notice a weird color and probably underlines if the variable or function is undefined so I can fix the issue before it crashes somewhere in the future<p>2 also helps me when it highlights unused stuff, shows me that a refactor or a merge happened and it needs a closer look<p>3 we put JSDoc type documentation and colors will look different if say you used a method on an object that does not have such method or member defined<p>I create my personalized color schemes that fit me and my disabilities so I don&#x27;t care if maybe it does not work for someone else or if soem dude tested on some students and observer some small effect or even worse some designer decide how my stuff should look because he read some blog posts from his guru and now he thinks he is a UX master.<p>I suggest people try a good IDE, tweak things, I always notice bugs in my colleagues code that a good IDE would have prevented them.
sqrt17over 3 years ago
Skimming code is a legitimate task. At a large&#x2F;FAANG company you will often have a 400k sloc code base and only a vague idea which bits of code you need to study more intensively to find out what you need.
krylonover 3 years ago
One size does not fit all. If you are more productive without syntax highlighting, by all means, disable it.<p>When I first started to program, I found syntax highlighting annoying and distracting, but I changed my mind within a year or so. So I have tried both sides and made my choice.<p>I also think that the usefulness of syntax highlighting depends a lot on what language you are using. For example, I found it very helpful when working with Perl, but nearly pointless when writing SQL. Like I said, one size does not fit all.
kevin_thibedeauover 3 years ago
The problem in the example is excessive contrast that interrupts the visual connectivity of related elements. Stop using party-colored themes and the highlighting is less objectionable
评论 #28494897 未加载
评论 #28494219 未加载
drenvukover 3 years ago
I have a hunch that everyone who is against syntax highlighting is somewhat color blind.
评论 #28494664 未加载
4adover 3 years ago
I can&#x27;t stand syntax highlighting. I mean literally -- I can&#x27;t read code that is displayed using syntax highlighting, and when someone tries to force me to, I can&#x27;t understand it. When someone ask for my help with a piece of code, I have to ask them to turn the highlighting off (which in some editors is harder than you think). I normally use acme, which doesn&#x27;t even have syntax highlighting, but it bothers me to no end that on some (many? all?) Linux distributions vim comes by default with syntax highlighting on. Fortunately BSDs come with nvi, which also doesn&#x27;t have syntax highlighting.<p>Unfortunately, most blog posts and documentation on web sites spam syntax highlighting in my face. For those cases I copy the code in my editor to read it which also has the benefit of allowing me to see it with proportional fonts. I use proportional fonts for my programming.
评论 #28494909 未加载
approxim8ionover 3 years ago
I see past syntax highlighting for the most part- until I need it and then I don&#x27;t. I don&#x27;t understand a lot of this &quot;convenience is a crutch&quot; rhetoric around programming. Yes, it&#x27;s a crutch, but for many of us, maybe even most, it enables us to work on the stuff that matters with more ease.
sfgover 3 years ago
Syntax highlighting helps reveal structure, so you can understand the whole at a glance, before then zooming in on a part to gain deep understanding. Without the revelation of structure, identifying the parts to go deep on would only be harder.
gumbyover 3 years ago
Syntax highlighting was originally done with typography, not color. Just look at, say, Smalltalk code from the 70s, where italics and bold were used to distinguish syntactic elements. This was also common in academic papers of the late 70s and early 80s as laser printers became more common.<p>This error helps make the author’s point:<p>&gt; Maybe it was introduced in order to flatten the learning curve.<p>The steeper the curve, the easier to learn, so I suppose by flattening it you are deliberately making learning the piano more difficult.
评论 #28498130 未加载
monkeyfacebagover 3 years ago
Douglas Crockford has made a similar argument. <a href="https:&#x2F;&#x2F;www.crockford.com&#x2F;contextcoloring.html" rel="nofollow">https:&#x2F;&#x2F;www.crockford.com&#x2F;contextcoloring.html</a>
评论 #28496437 未加载
评论 #28499138 未加载
david_allisonover 3 years ago
(2007)<p>I&#x27;m not convinced, but this is an interesting take.<p>The selected examples are unfair as they use a badly contrasted foreground color against a white background which break all the WCAG Guidelines for contrast. IDEs should use colors with an accessible contrast ratio.<p>#00dd00 (green) -&gt; #ffffff: 1.85:1 - fail on all results<p>#00dddd (cyan) -&gt; #ffffff: 1.70:1 - fail on all results<p>I feel another exception would be the differentiation of static, member and local variables as an additional IDE-based hint, on top of naming conventions.
da39a3eeover 3 years ago
Um, no. The article&#x27;s argument, to the extent that there is one, is based on the claim that syntax highlighting natural language doesn&#x27;t help. But code is not natural language. It is dominated by a small number of common keywords (function&#x2F;class definitions, for loops, etc) and for these it -- shock! -- is helpful to have them standout visually from the less predictable content.
AprilArcusover 3 years ago
I find that even the most vacuous syntax highlighting helps me read code by creating smaller chunks and calling attention to repeated patterns.
nomaxx117over 3 years ago
This is not a very convincing argument at all. Syntax highlighting takes away the mental burden of analyzing the syntax of a program, freeing the programmer to think about the structure and semantics of it. A good IDE (a good vim setup can count too) goes further, making the structure and semantics of a program more easily discerned.
italicboldover 3 years ago
Highlighting also exists to increase edit-ability.<p>Look at the authors own example, if you want to change the number of iterations in the loop or edit a type, you can do that practically instantly. Does this come at the cost of readability? Perhaps. This is also probably subjective and for the author the cost is apparently too great.
snicker7over 3 years ago
For emacs, I recommend the &#x27;almost-mono-themes&#x27; package [0]. It supports syntax highlighting without making your editor look like Mardi Gras.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;cryon&#x2F;almost-mono-themes" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cryon&#x2F;almost-mono-themes</a>
thrower123over 3 years ago
Extraordinary.<p>I don&#x27;t know what it is about programming that churns out these takes about not using effective tools and making things harder on yourself. There&#x27;s this odd strain of ascetic masochism that breaks out from time to time that I can&#x27;t say I&#x27;ve observed much in other subcultures.
henvicover 3 years ago
This is why <a href="https:&#x2F;&#x2F;play.golang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;play.golang.org&#x2F;</a> has a simple layout with no highlight syntax :)<p>* based on Acme <a href="http:&#x2F;&#x2F;acme.cat-v.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;acme.cat-v.org&#x2F;</a>
WalterBrightover 3 years ago
This inspired me to:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;DigitalMars&#x2F;med&#x2F;commit&#x2F;adcc084e21427236957a7f94f3547b22a89c7c1c" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;DigitalMars&#x2F;med&#x2F;commit&#x2F;adcc084e2142723695...</a>
mseepgoodover 3 years ago
How do I disable syntax highlighting in JetBrains IDEs? I can choose all kinds of color schemes, but there is no predefined &quot;Plain&quot; color scheme. I would have to create a new scheme and go through each syntax element and reset the color manually.
jonnycomputerover 3 years ago
Bold claims + no-evidence<p>A point of counter-evidence. Developers seek out syntax highlighting. Perhaps they&#x27;ve all been duped by the hype. Orrrrrrr they actually find it helpful.<p>Without more evidence, I&#x27;m going with #2.
zh3over 3 years ago
Needs an old year in the title (2007?).<p>In 2007, I might have agreed.<p>In 2021, I&#x27;ve added syntax highlighting to my own editor (and things feel harder without it).
deltasixeightover 3 years ago
Look man. I&#x27;m not going to rationalize this.<p>The main reason why I use syntax highlighting is because I&#x27;m use to it and it looks cool.
WalterBrightover 3 years ago
I like syntax highlighting, but prefer the colors to be more muted rather than garishly standing out.
xondonoover 3 years ago
The comparison with prose is pure nonsense.<p>Syntax highlighting is about understanding structure.<p>I could blur out my editor to the point where I could not make out individual letters and still understand the code structure.<p>When reading prose you don’t care about structure, especially not in English (in latin languages structure is way more important).<p>It’s important to have a good highlighter though. STM32cube IDE has a very bad highlighter that gets confused sometimes.<p>I’ve seen people chasing simple bugs for far too long just because the highlighter was broken.
评论 #28494826 未加载
评论 #28498584 未加载
评论 #28494817 未加载
FpUserover 3 years ago
&gt;&quot;Syntax highlighting is a standard feature of most modern text editors&quot;<p>Sorry it was a standard feature in some IDE&#x27;s like forever. Nothing is modern about it except the fact that the amount of what being recognized and made visually different did increase thanks in good part to language servers.<p>As for giving it up - well for what I care they could still use punch card, their choice. For me - I would not give it up.
评论 #28499170 未加载