Code Comments

I am a firm believer in code comments among other things.   So when I came across a blog post at  http://blog.jooq.org/2013/12/04/when-source-code-comments-indicate-trouble/ talking about amusing comments coders leave in their code for people to find later I followed the links and found this:

http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

// Dear maintainer:

//
// Once you are done trying to 'optimize' this routine,

// and have realized what a terrible mistake that was,

// please increment the following counter as a warning

// to the next guy:

//
// total_hours_wasted_here = 42

//

The code comment above does however highlight an issue for consideration when writing code. Who will support and maintain your code? Write comments to help them as they have to live with your creation.

When coaching youngsters I would always challenge them to write code that people less able than themselves could read and follow.  By doing this it allows you to easily handover your code to a support group and you can move on and write new applications.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.