Re:Programming Lessons I've Learned in 20 Years
by DeusExMachina on Friday November 12, 2010 @10:03AM
(#1897839)
Document your code - Whether its documenting a Web Service API or documenting a simple class, document as you go. I've been accused of over-commenting my code and that's something I'm proud of.
This is something I'm "guilty" of not doing, but I really can't. In the beginning I was commenting a lot my projects, even writing Doxygen documentation for every class and method. But I find it really disruptive of my programming process. While I write code my thoughts go on pretty fast, and stopping commenting breaks my flow. Doing it after the code is completed does not work for me, I never do it and these kind of tasks accumulate. Moreover when I read code I never read comments, but just the code.
I believe that very well written code does not need much commenting. I put comments when I do something that can't be evinced by the code because is some sort of exception or workaround.
This is something I'm "guilty" of not doing, but I really can't. In the beginning I was commenting a lot my projects, even writing Doxygen documentation for every class and method. But I find it really disruptive of my programming process. While I write code my thoughts go on pretty fast, and stopping commenting breaks my flow. Doing it after the code is completed does not work for me, I never do it and these kind of tasks accumulate. Moreover when I read code I never read comments, but just the code.
I believe that very well written code does not need much commenting. I put comments when I do something that can't be evinced by the code because is some sort of exception or workaround.