3 ms·
There's at least two phases of developing code. There's the solving of the problem at hand, and getting the expression of that solution towards syntactically co
by Isofarro 15y ago
There's at least two phases of developing code. There's the solving of the problem at hand, and getting the expression of that solution towards syntactically correctness.
Colour syntax highlighting is merely a "live syntax checker" - albeit not as good as a compiler or linter (it's simpler in nature). But the value it adds is sufficient to make it a useful aid. It's the coding equivalent of Word's squiggly red line spell-checker, it draws attention to things that may be issues when the colour highlighting looks odd.
If the colours are distracting, then it is the colours that are the issue, not the concept of syntax highlighting. So subdue them enough.
Colour syntax highlighting is a visual indicator that the code looks syntactically correct. With that as a confidence indicator it's easier to dive into the logic itself, knowing that you're mostly on solid ground syntax wise.
Plus, colour provides quick visual hooks to various parts of the code. It allows skimming through the code to find the prescient part easier. Yes, it makes it easier to skip past commented out code -- those should be deleted at an appropriate point. And it's easier to delete that commented out code when it's colour coded than without.
Developers fight with their code on multiple levels. Colour-coding helps deal with one particular level of that code - syntactic correctness.
Developers know that syntactical correctness doesn't mean the problem is solved. It just means that the attempted solution to that problem is considered syntactically correct.
I think the only interesting point in the author's piece is the point that English text is more difficult to read when it's randomly coloured. When we get to an x-Generation Language levels where we can develop programs in plain English, I'd agree with the author that colour syntax highlighting doesn't add sufficient value at that point. But we are still stuck in a hybrid computer-friendly constrained language constructs, and with those constrains, colour syntax highlighting assists developers to confirm the code is syntactically valid.
- mayoff 15y agoYou said “I think the only interesting point in the author's piece is the point that English text is more difficult to read when it's randomly coloured.” Åkesson didn't talk about random colors. His sample text isn't randomly colored. It's colored by part-of-speech. Nouns are red, verbs are green, etc. I find the yellow and green parts of his sample text particularly difficult to make out, because of those color choices, not because of the changing of colors from word to word. If Åkesson wants to claim that “it will inevitably decrease the legibility of the text”, he needs to cite a study demonstrating this. As far as I know, he's just speculating. We have a historical reason, at least, for writing prose in just one color: it is much easier to write or mass-print in one color. But now we live in an age of computers, and we could perhaps have the computer syntax-color our prose when we read (and write) it on screen and print it to a color printer. If a reader had time to get used to reading syntax-colored prose (and the color scheme were chosen well), would the reader be able to read faster or understand the material better? This question has to be answered by testing, not speculation.
- davegauer 15y ago"If a reader had time to get used to reading syntax-colored prose..." Ha, that's exactly what I thought when I saw that example, too. Wouldn't written English be much easier to learn (for both children and for ESL learners) if we always wrote the different parts of speech in different pleasant/subtle colors?* It would certainly make skimming text much easier for advanced readers - much as syntax highlighting makes skimming source code much easier for professional developers. *(Or perhaps slightly different typefaces to get around colorblindness issues.)
- swah 15y agoBut OTOH we skim so much that we can't read anymore :)
- davegauer 15y agoI don't think it has to be an either/or proposition. I read some things and skim others. You'll be happy to know I read your entire comment word-for-word. :-)
- swah 15y agoSure, I mean't in the sense that "British researchers say we (the internet generation) are getting worse at reading books (but we're very good at finding the useful information in a crowded website).