Comments in code

Posted by DavidMadden on Geeks with Blogs See other posts from Geeks with Blogs or by DavidMadden
Published on Wed, 28 Nov 2012 15:13:30 GMT Indexed on 2012/11/28 17:06 UTC
Read the original article Hit count: 252

Filed under:
It is a good practice to leave comments in your code.  Knowing what the hell you were thinking or later intending can be salvation for yourself or the poor soul coming behind you.  Comments can leave clues to why you chose one approach over the other.  Perhaps staged re-engineering dictated that coding practices vary.

One thing that should not be left in code as comments is old code.  There are many free tools that left you version your code.  Subversion is a great tool when used with TortoiseSVN.  Leaving commented code scattered all over will cause you to second guess yourself, all distraction to the real code, and is just bad practice.

If you have a versioning solution, take time to go back through your code and clean things up.  You may find that you can remove lines and leave real comments that are far more knowledgeable than having to remember why you commented out the old code in the first place.

© Geeks with Blogs or respective owner