Jump to content

Comments are critical to good programming practice


G+_mike klaene
 Share

Recommended Posts

Comments are critical to good programming practice. Granted I am a dinosaur when it comes to programming having started in 1969 with S/360 Assembler. I had taught for a couple of years as an adjunct and one thing I stressed was the need for meaningful comments. If you need to work on a change to code you wrote more than 6 months ago it will be almost like you are working on some other programmer's code.

Link to comment
Share on other sites

Nathan Follmer?, mike klaene? there's a school of thought that says extensively commenting your code is a bad idea. I suggest reading Robert C Martin's (aka Uncle Bob) Clean Code book if you haven't already.

For a beginner I think comments are a good idea (because beginners aren't in a position to read the code and immediately understand what it does), but for a professional maintaining a large code base the Uncle Bob theory is that you should write easily understood code so that most comments are superfluous.

There's still a place for comments in particularly tricky code but I think they should be the exception not the rule.

Link to comment
Share on other sites

Having spent 45+ years writing and maintaining code, I can assure you that meaningful comments can be a life saver. The 2nd language I learned, after Assembler, was COBOL which was designed to be self-commenting. It is not always easy to follow - particularly with a period being misplaced.

 

Obviously, any tool, can be used wisely or carelessly. This includes both comments and objects.

Link to comment
Share on other sites

 Share

×
×
  • Create New...