Commenting your code is a Best Practice, but if my comments are in the way, turn them off

So it seems like a lot of people have been weighing in on the discussion of code commenting. Well I thought I would throw in my two cents.

I agree with Ben

Now that we've go that out of the way. I also agree with one aspect of the argument not to comment. And that is that sometimes comments get in the way of reading code and figuring out what it does. But does that mean we should stop commenting our code? I say no. Instead, if I feel that comments are in the way, I turn them off.

Now, there is not a button to turn off comments in Eclipse (at least I don't think there is) but there is a relatively simple way to make them virtually invisible.

First, go into Window>>Preferences (Don't know if this is different on Mac or Linux) and go into your options for CFEclipse.

Set your CFML Comment color to White:

Turn on Code Folding for comments and set the minimum number of lines to 1.

Now you can turn really verbose comments(like in Luis' ColdBox.cfc):

Into no comments:

And if you do want to read the comment, you can expand and highlight:

Jim Priest's Gravatar Interesting - it seems there should be a way (I have no idea how) to make a button that turns comments on/off.
# Posted By Jim Priest | 6/5/08 11:23 AM
Jason Dean's Gravatar That would be really cool, Jim
# Posted By Jason Dean | 6/5/08 11:33 AM
Brian Kotek's Gravatar I hadn't thought of just "whiting out" the comments, that is an interesting option. But the issue doesn't really have anything to do with reading the code (at least to me).

The issue is that many comments are either redundant or are a duplication of information. So not only do comments often indicate that something is too complicated, but they also make maintenance more difficult because the comments have to be updated every time the code changes. If the code is clear and self-documenting, this problem is eliminated. So comments are great when used judiciously, but redundant comments or comments that are necessary to explain overly complex code should be avoided.


# Posted By Brian Kotek | 6/5/08 1:10 PM
Jason Dean's Gravatar @Brian - I can certainly agree that having to update comments with code changes is a pain, and half of the time I forget, I also hate writing comments that almost word-for-word repeat the code.

I guess one consolation is that with OO development we will likely be spending less time changing our code (hopefully).

As for self documenting code, I agree that it is probably safe to leave the comment off of:

<cfset salesTaxRate = "0.0625" />

There certainly is a lot more to the discussion, and I understand where you are coming from, but I do recall someone in the posts today talking about the readability of commented code, and that is what I was looking to address.
# Posted By Jason Dean | 6/5/08 2:07 PM
examcollection HP0-S45's Gravatar Great insight of this topic! The article is magnificent and unique, writing style quite innovative.
# Posted By examcollection HP0-S45 | 8/11/16 2:53 AM
# Posted By william7848 | 8/11/16 2:57 AM
karthik devuluri's Gravatar usps tracking
usps tracking online
# Posted By karthik devuluri | 4/16/17 5:09 AM
# Posted By srinivasvarma2119 | 5/24/17 7:11 PM
Vikas Kumar's Gravatar If you are a Mac user, don’t worry download IMO for Mac PC here. I ensure that this article gets you the answers to all of your questions. Do you know why WhatsApp became so popular than any other social messenger applications? Because of its simplicity in its user interface.
# Posted By Vikas Kumar | 7/14/17 4:17 AM
Tango's Gravatar This is awesome.
# Posted By Tango | 8/12/17 10:00 AM
Root King APK's Gravatar Kodi is an open source home theatre which was formerly known as XBMC. <a href=" Kodi</a> was developed by XBMC Foundation, as a non-profit technology conglomerate. <a href=" Showbox App Download</a> is free multimedia software capable of playing various formats of videos and audio files.
# Posted By Root King APK | 8/17/17 3:05 PM
Toni Smith's Gravatar Good
<a href="">Click here</a>
# Posted By Toni Smith | 3/12/18 8:40 AM
Toni Smith's Gravatar Good
# Posted By Toni Smith | 3/12/18 8:41 AM
AndrewKaur's Gravatar The internet is not just remaining a technology but becoming a part of our lifestyle. From texting our friend to booking hotels and buses everything is possible at just one tap. In such a scenario, the emerging issue is about privacy and security of our phone storage. That is why we think to write about <a href="">Psiphon apk</a> today
# Posted By AndrewKaur | 3/29/18 9:31 AM
701-100 exam dumps's Gravatar Now, there is not a button to turn off comments in Eclipse (at least I don't think there is) but there is a relatively simple way to make them virtually invisible.
# Posted By 701-100 exam dumps | 10/10/18 4:52 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1. Contact Blog Owner