4 ms·
Syntax Highlighting / Code Colouring
- edw519 19y agoTell you why I don't like syntax highlighting (or any crutch er,a helper). Ever since I read the chapter about Woz in Founders at Work. The thing that he thought made him so successful designing the Apple II: he knew every single little part of it intimately, like the back of his hand. That struck me like a lightning bolt. So that's how I feel about my code now. If I want to do something, I read and reread and reread it over and over and over until I practically memorize it. THEN it's part of MY firmware, and that's when I really get insightful and productive. IDE's, syntax highlighting, etc. are just crutches that keep my real "hacking muscles" from developing. I won't use them. Black and green; that's all I know. Similarly: I used to know every phone number I ever needed by heart until speed dial came out. One day last year, I had the very frightening experience of not being able to call a regular number from someone else's phone. I have never used speed dial since. Anything that impedes my "brain exercise" is something I do without.
- jgrahamc 19y agoI have no idea what my wife's cell phone number is; I entered it in mu cell phone once and I just think of her as 2# :-) John.
- euccastro 19y agoI don't know my cell phone number. If someone asks and I'm carrying my GSM, I send them a missed call so they get it. But quite often I forget it at home, and that's embarassing; they think I'm making excuses to avoid giving them my number.
- edw519 19y agoWhat you call embarassing I call scary.
- mechanical_fish 19y agoThere's an important distinction between "brain exercise" and actual thinking.
- edw519 19y agoRight. Just like there's an important distinction between pushing a blocking sled and playing a football game. No matter how good they get, athletes still train their bodies. And hackers still train their brains.
- asdflkj 19y agoIs indentation also a crutch that keeps your hacking muscles from developing? As far as I can tell, arguments for and against both are exactly the same. If you like one and not the other, it's a sign that these are matters of personal preference more than anything else.
- pfedor 19y agoThat's a very nice point and thanks for making it, but based on the empirical evidence I think that you're wrong. There are many very good programmers who don't use syntax highlighting. But I don't know anyone who is not using indentation. So there has to be an important difference between the two.
- jgrahamc 19y agoI made the following comment over at reddit on this story; thought it might be of interest here: As part of building the test suite for the POPFile project I built my code code coverage module that produced colored files (one per source file) indicating which lines had been exercised by the test suite and which had not. Each line is colored green if the test suite executed it, red if not. Lines are numbered. An example of this can be found here: http://popfile.sourceforge.net/Module.html http://popfile.sourceforge.net/Module.html The code that does this is part of the POPFile project under the GPL. John.
- gills 19y agoI find it ironic that people who create technology to automate tasks in the lives of others refuse to automate tasks in their own. I recall a group of folks who once refused to use looms because it wasn't as "pure"... I find syntax highlighting very useful. In fact, I use as much as I can. I want to offload as many mental "maintenance" tasks to the computer as possible, so I can concentrate on the real problems.
- edw519 19y agoI prefer to do the mental maintenance tasks myself. Just like Tiger Woods hits 400 balls a day or Kobe Bryant shoots 1000 shots a day. I know my code like the back of my hand so when I wake up at 3:00 a.m. with a thought, I don't need a listing; I know. Nothing ironic about it.
- gills 19y agoI respect your preference, so I will try to respond with some colloquial form of reasoning. Please forgive the slight abuse of information theory...in general, styled text will have lower entropy than the same un-styled text. Low-entropy text will be more memorable than high-entropy text because it contains more information. It's like a chapter heading in a book - not only is it interesting and informative, the style provides the context that it is a heading and not the first sentence. Re-reading my previous comment, one could misconstrue that my editor looks like a crayon box. It doesn't. I use fairly subtle styles for most parts of the text, with only a select few items in bold or bright styles (keywords, constants). It helps to skews the distribution of what grabs my attention and what does not.
- deleted 19y ago[deleted]
- mechanical_fish 19y ago"When Perl 6 arrives I'd like a two colour system that indicates whats a new Perl 6 feature and whats an old Perl 5 feature." This is one of the funniest sentences that I have ever read. Is this satire? Or should I be even more glad that I switched to Ruby than I already am?
- tlrobinson 19y agoWhy am I not surprised that a Perl programmer feels that he's too good for syntax highlighting? That said, I do like some of his alternative highlighting ideas. Maybe someone can hack together something with svn/cvs, etc.
- BrandonM 19y agoI'm surprised how many people don't like syntax highlighting. I appreciate it because it helps me eliminate a small class of errors while coding, which is misspelling keywords and improperly delimiting expressions. In Python, for example, there are 4 different ways to delimit strings, so having syntax highlighting indicates quickly to me when I accidentally ended a multi-line string with a """ instead of what I began it with: '''. I also find myself doing weird things sometimes when I get tired, like instead of saying "class Foo", I'll type "def class Foo". Seeing the keyword "class" stand out in the second instance is a quick clue that I'm doing something stupid. There are also cases where I've unthinkingly wanted to name a variable the same as a keyword. Without syntax highlighting, I would have received a strange error at compile time complaining about invalid syntax, but instead, I see right away what I've done and avoid the problem altogether. In the end, it's not a matter of whether or not I know my code or know the language inside and out. It's simply a matter of quickly and effectively fixing a large majority of small gaffs in my thinking and inadvertent mistakes. Call it a crutch all you want, but you could just as easily say that if you're not coding in hex, you're using a compiler as a crutch. What's wrong with making your job easier?
- andreyf 19y agoAll of his suggested additions can fit in a column on the left hand side of the code, since they only apply to lines, not words.