- Back to Home »
- Comment your code ...
Posted by : Deepak Vasudevan Friday, September 26, 2008
Comment your code ...
For any programmers, it is always strongly recommended to have explicit comments to strategic sections of the code. Commenting a code is very important for many reasons:
- It would serve as a valuable memory into what the particular code does. You may not know that down the line, after five years, when you see the code without comments, the same code might sound greek and latin.
- A good commented code can easily enable a peer developer to start maintaining it without bothering you for pesky queries on the same.
- Where possible, try using summary commenting like in JavaDoc and C# Xml commenting features.
When not to comment?
- If you are replacing a logic with another logic, do not comment the older logic and append the new one, as far as possible. That would only serve to increase the file size and complicate the maintainability of the code. To maintain history, use a good Source Control rather.