Live data from Hacker News

Syntax Highlighting Off

robertmelton.com

81–90 of 110 posts

Re: Syntax Highlighting Off

#81
post #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.)

went dark years ago, never looked back. "one year something changed - I don't know exactly what" - you matured:)

Have not--how dare you!

Re: Syntax Highlighting Off

#82
post #12

Many syntax highlight themes seem to hide comments in code by decreasing their contrast. I'm strongly against that so for me the author lost credibility when I saw that's more or less only what his theme do.

Comments lie, frequently. The only time I need to look a comments is when someone has done a poor job of naming things. The comments may explain intent, but they do not explain what it's doing. Never question someone's credibility because their preference differs from yours. It'll make people question your credibility.

If your comments lie, you're doing it wrong.

Re: Syntax Highlighting Off

#84
"One of the basic rules of thumb in typography is that, when writing a piece of text, you should choose one typeface and stick to it."

How about an analogy from cooking, too?

"It's easy to spot all the verbs, but why on Earth would you want to do that? "

Well, exactly! Makes it obvious how stupid your argument is, huh?!

I'm pretty sure the people who choose syntax colouring know what they're doing, just like the ones who don't use it. One of those choice things.

Re: Syntax Highlighting Off

#85

Earlier quoted context omitted.

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…

>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. There's a lack of experience in professional circles too. One of the questions I always ask during programming interviews (on either side) is "is your code clean? if so, why?". Invariably the answer is a variant along the lines of "if it passes the linter it's clean",…

Perhaps you should use a less ambiguous term than "clean". They're giving you a correct answer, so perhaps you should ask the correct question? "Is your code readable", perhaps? "Are you proud of your code?". Something like that. No-one's going to admit their code isn't clean, regardless of how they interpret that term.

Re: Syntax Highlighting Off

#87
post #45

Earlier quoted context omitted.

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 t…

I found the Alice in Wonderland image at http://www.linusakesson.net/programming/syntaxhighlighting/ particularly compelling, in support of the argument that highlighting may emphasize syntax at the cost of obscuring semantics.

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

Re: Syntax Highlighting Off

#88

I went the other direction, I programmed for decades without syntax highlighting because back in 1989 I thought ANSI color directory listings were for MS-DOS weenies, so I used a monochrome terminal for everything. I finally became a software developer and adopted syntax highlighting and haven't looked back. Catching unterminated strings and mismatched do..end blocks in ruby saves an incredible amount of time where y…

I tried it with and without recently, I found that for languages I'm familiar with having it on or off made no difference however having flag errors on off did.

For languages I don't use much I found having it on more helpful, could I work without it of course, I grew up with computers that didn't have syntax highlighting but I'd miss it.

One side result of the experiment was that I turned down the number of colours I used, not everything needs to be a different colour.

Re: Syntax Highlighting Off

#89
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 us…

Alongside the errors which I agree with and mentioned elsewhere one of the things I really like about intellij (sure others do it) is you can highlight the variable under the cursor in different colors (for read/write), I have mine set to dark red for writes and green for reads, That really helps as you jump around code as you can stick it on a method and it highlights all calls to that method in the code.

Re: Syntax Highlighting Off

#90
post #12

Earlier quoted context omitted.

Comments lie, frequently. The only time I need to look a comments is when someone has done a poor job of naming things. The comments may explain intent, but they do not explain what it's doing. Never question someone's credibility because their preference differs from yours. It'll make people question your credibility.

If your comments lie, you're doing it wrong.

Not a lot of team experience I'm guessing?
Post reply on HN