Live data from Hacker News

Syntax Highlighting Off

robertmelton.com

41–50 of 110 posts

Re: Syntax Highlighting Off

#41

What I've once read is that the advantages for syntax highlighting are biggest for beginners (in general or in that programming language). This seems logical when looking at what syntax highlighting does: colouring differently according to the token type. Beginners might have more problems finding the borders of what belongs together and what kind of token something is. If we compare this with classical text, we won'…

It can also help when jumping around between many different languages, especially when they are similar.

Interestingly enough, the author of the article notes that it has become easier for him to jump around different languages.

Re: Syntax Highlighting Off

#42
post #32

This post misses, for me, the greatest benefit of programming without syntax highlighting enabled. I went through a period of doing it for 5 years or so and the biggest effect was ultimately on how I wrote code, not how I read it. Without syntax highlighting I gradually became more focused on the legibility of what I was writing, because none of the visual cues were there when I read stuff back. Function length, modu…

I'm glad you had a positive experience, but I'd like to point out that thinking about legibility, whitespace, naming etc should be done regardless of highlighting.

I don't blame you, IMO it's one of the major issues with computer science education. Even basic principles of clean code are often neglected or never taught, in large part due to the lack of professional experience in academic circles. This leaves aspiring developers to figure it out on their own, as you did through turning off highlighting. I'm glad you did, but there are better ways to learn the same concepts IMO.

Re: Syntax Highlighting Off

#43
post #24

I'd freely speculate that 90% of the benefit of syntax highlighting comes from mere lexical highlighting - specifically, making comments, strings and keywords visually distinct from everything else. And even keyword highlighting is very secondary to the first two. Making comments distinct from normal code is nice because you can easily alternate your focus on one or the other while reading through; and you're not lik…

One of the most important benefits of syntax highlighting that no one in this thread seems to be discussing is the highlighting of syntax errors. That is the number one benefit of syntax highlighting for me. It immediately shows me where there's a problem in my code (like if I haven't closed parenthesis or quotes) and keeps me focused on "completing the thought", as it were.

This is also a reason that I don't like using editor features that automatically close parenthesis or quotes when you type the opening pair. That may make the expression syntactically correct, but semantically incomplete and the burden will be on me to notice, since syntax highlighting won't help me then.

Re: Syntax Highlighting Off

#44
post #3

Next step: programming using ed. But jokes aside, use whatever environment you like best. For me syntax highlighting is extremely useful. Knowing whether some strings of characters is a type or a variable, or a class type or a basic type makes programming just that much easier. It also helps catching simple typos if something doesn't have the color you'd expect.

A high number of Unix programmers (Ken Thompson, Brian Kernighan, Doug McIlroy, Tom Duff & Bjarne Stroustrup) used sam at Bell Labs, which is known as "ed on steroids, lots of steroids".

http://sam.cat-v.org/

Re: Syntax Highlighting Off

#45
post #34
post #29

I don't understand the reasoning behind this. What possible benefit could you get from turning off all syntax highlighting? It's useful to distinguish between language keywords and user specified names. Being able to visually ignore one of them, while focusing on the other, is a tremendous benefit. It cuts down the number of things you need to hold in your head at once, by half. It's useful to distinguish between loc…

> I don't understand the reasoning behind this. What possible benefit could you get from turning off all syntax highlighting? He explained his reasoning (and theories why it would work) in enough detail. You might disagree, but I can't see how you can't understand it. > It's useful to distinguish between language keywords and user specified names. Being able to visually ignore one of them, while focusing on the other…

Yes, I read his reasoning, but I still can't make sense of it. The most common theme seems to be that having more colors is "distracting". I mean yes, having more colors gives your eyes more things to process... the same way that 7 letter variable names creates more work for your eyes compared to 2 letter variable names. But if someone told me that they avoid naming their variables using complete words because it's too distracting, and only used 2 letter symbols, I wouldn't understand that either.

From a physics/math perspective, yes, I get that "more" implies more entropy. Having 4 colors on your screen is more entropy compared to 2 colors. Having 7 letter names is more entropy than having 2 letter names. But if that additional entropy is used to convey clear, unambiguous and useful information, it actually makes the overall message simpler. The same way that long/descriptive variable names make reading code simpler compared to random 2 letter symbols.

On more reflection, the one reasoning I can somewhat understand, is the idea of handicapping yourself. If you force yourself to type with one hand behind your back, it gives your brain additional incentive to find concise solutions. In theory, I guess I understand this line of reasoning, but in practice, I'll still continue typing with both hands, thank you very much.

Anyway, just thinking aloud here. When I come across something I don't understand, I try my best to understand what the other side might be thinking. Not trying to attack anyone... to each his own. Best wishes.

Re: Syntax Highlighting Off

#46
I have had syntax highlighting off for a few years, but I always turn it on when looking at XML... especially poorly formatted files. It helps my eyes navigate the soup. That's where I think the value is: it helps to make up for confusing formatting.

Re: Syntax Highlighting Off

#47
There's an Atom theme called Hacking the Kernel that does some minimal bolding of keywords but is otherwise monochrome. I use it at times but never thought about whether I was faster with it.

Re: Syntax Highlighting Off

#48
post #3

Next step: programming using ed. But jokes aside, use whatever environment you like best. For me syntax highlighting is extremely useful. Knowing whether some strings of characters is a type or a variable, or a class type or a basic type makes programming just that much easier. It also helps catching simple typos if something doesn't have the color you'd expect.

A high number of Unix programmers (Ken Thompson, Brian Kernighan, Doug McIlroy, Tom Duff & Bjarne Stroustrup) used sam at Bell Labs, which is known as "ed on steroids, lots of steroids". http://sam.cat-v.org/

From an interview with Peter Salus [1]:

  By the way, 'em' stands for 'editor for mortals' - I 
  christened it that after Ken Thompson visited our lab at 
  QMC while I was developing it and said something like: 
  "yeah, I've seen editors like that, but I don't feel a need 
  for them, I don't want to see the state of the file when 
  I'm editing".
[1]: http://web.archive.org/web/20080103071208/http://www.dcs.qmu...

Re: Syntax Highlighting Off

#49
Purely eye candy here--visual enjoyment that makes code seem more interesting and fun.

Did anybody else go from needing a white background, to preferring a dark one?

(I had the zebra effect for years when trying to read light-on-dark, then one year something changed--I don't know exactly what.)

Re: Syntax Highlighting Off

#50
post #3

Next step: programming using ed. But jokes aside, use whatever environment you like best. For me syntax highlighting is extremely useful. Knowing whether some strings of characters is a type or a variable, or a class type or a basic type makes programming just that much easier. It also helps catching simple typos if something doesn't have the color you'd expect.

A step up from ed but a step below vim is nvi.

I've always preferred nvi over vim because:

1) there's no lag when I scroll up or down through a file line-by-line,

2) it shows a list of matching files by default when using tab completion in command mode (same as bash), vs picking the first matching filename, and

3) it uses fewer resources when you screw up (http://galexander.org/vim_sucks.html)

I used to think that the lack of syntax highlighting was its biggest weakness, but now that's apparently a virtue :-) .

Post reply on HN