Hacker News new | ask | show | jobs
by guiraldelli 1737 days ago
> Syntax highlighting speeds up readability, helps write correct code and IMHO, it makes code look pretty.

This is a wild claim, and my own experience shows quite the opposite.

For two years, I have been interacting with source code without syntax highlight.

As a result, I feel I am more focused on the content and less distracted. Particularly, that is very noticeable when reading foreign (i.e. other people's) code.

I actually feel that I read slower, but way more attentive. I actually give my brain the time to process the information, and as a result, I get a lot of overlooked bugs that other reviewers don't.

I still find useful, at times, to make the comments in another color, but I noticed that doing so, my brain ignore the comments and a lot of incorrect comments, that could be corrected, went overlooked several times.

Wishing or not, colours are tax your cognition, and for a visual person as I am, they were way bigger distractions than supports: I don't need colours to tell me "for" is a reserved word.

I also find font ligatures very distracting, but it was way more obvious to me that they contribution was negative compared to syntax highlight.

> 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.

Well, semaphores have just three elements, which are never shown simultaneously and the colours are well based on semiotics.

That is not the case for syntax highlight.

Syntax highlight seems closer to Stroop test [1] than semaphores.

> 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.

Have you looked to a text written in German? That is… Tiring!

In German, all nouns are capitalised. Reading a prose in German LOokS lIkE this TO mE.

I think syntax highlight is the equivalent capitalisation of nouns in prose.

[1]: https://en.wikipedia.org/wiki/Stroop_effect

1 comments

> In German, all nouns are capitalised. Reading a prose in German LOokS lIkE this TO mE.

This is hard to read both because capitalization is a clue that another sentence is starting in English and because uneven multiple capitalization makes it harder to recognize a word. Your brain almost stutters as it pauses to turn the unfamiliar LOokS into looks. Presumably Germans expect the additional capitalization and don't experience this extra processing whereas if you are used to English you are used to deriving different data from more sparsely applied capitalization. While LOokS causes poorer performance for everyone. I think your comparison of highlighting to German capitalization rules is more apt than comparing it to capitalizing random letters.

In keeping with the argument made earlier in the text this ought to improve your understanding of prose because it makes you slow down and really parse it. In reality your brain has a finite amount of processing power and memory and consciously focusing on turning unfamiliar structures into intelligible data and if the data you are taking in is complicated you are taking away resources by being forced to more consciously process it.

You might actually apply this thinking to your experience with syntax highlighting if you aren't used to it you attend to it more so than the data expressed by the code. Your preference and familiarity leads to a different experience than individuals who are used to using it. This doesn't make your preference wrong or right but I question your conclusion that it leads to more attentive reading. I suggest instead that if you discover oft overlooked bugs it is rather because are a more attentive reader rather than being down to reading without syntax highlighting being more effective.