Saturday, May 18, 2013

When to comment your code

The other day I was browsing through some of the organizations I follow on twitter when I stumbled across this post from Ardalis.com.  This is a great article for programmers just getting starting as well as season professionals.  It gives you a great insight about when its the proper time to add comments to your code.  I think there are times that programmers in general struggle with whether or not it's the proper time to comment code.  I believe the main reason maybe that most of us think we write clean code or our naming convention is second to none.  Personally, I try to only comment in complex situations where I absolutely need to describe a function or procedure to perhaps give myself or another programmer an idea so he/she knows what's going on.  The thing to remember is that, what makes since to you may not make since to the programmer that follows behind you.  Also, know one likes coming in on a project where every other line is commented or there are giant paragraphs that start with some thing like, "// Dear maintainer:".  On top of that, it's also extremely irritating at lease to me when there's code that was added three plus years old and the code itself is actually not in the project anymore.  Anyway, below is the link to the article, hope it helps you or anyone else needing some clarification or understanding when and/or where not to add comments into an application.  Happy coding!!!  Article Link

No comments:

Post a Comment