Saturday, February 11, 2006

Make Your Comments Count!

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


IDEs tend to de-emphasize comments. Visually, code is more prominent than comments. For example, while most IDEs use black for "code", in
NetBeans comments are light gray; in IntelliJ they are also light gray, in Eclipse they are light green and in Visual Studio they are also light green. In all cases, the comments have less visual weight than the surrounding code.



I have a new co-worker, and when I went over to his computer the other day I was shocked to see his modified syntax highlighting color scheme. He had basically turned everything to black - except comments. And the comments - bright red! His rationale is that comments are vital, and he wants them to jump out visually.



I decided I'd try out his scheme. Switching all comments over to red was too much - I like javadoc for methods to stay "quiet". So I settled on switching line comments over, and leave block comments alone (and these are always javadoc, because I use line comments in all other cases, even for comments that span multiple lines.)



I've tried it out for several days now and I think I might stick with it. Judge for yourself - if not by screenshot then in your own IDE.








(Click image for full size)


2 comments:

  1. How did you manage to set the line comment character differently from the multiline comment color?
    Netbeans Tools: Options: Fonts & Colors: Syntax only has a single category for "Comment".
    ^H^H
    OK, nevermind:
    Actually, there you can set a different color for block vs. line comment if you choose Language: Java. I thought some other readers might want to know that.
    What would be useful, however, is to be able to set the javadoc colors separately from block comments, since they are used for different purposes.
    Anybody who would like that might want to vote for this enhancement:
    http://www.netbeans.org/issues/show_bug.cgi?id=25509

    ReplyDelete
  2. [...]I was just going through a blog feed for Sun peeps and noticed an interesting post titled Make Your Comments Count! by Tor Norbye. His point was...[...]

    ReplyDelete