Commenting your code

Any developer who was worked with me, or just seen my code, will know that I am practically obsessive-compulsive about quality. I hate leaving unreadable code, loose ends or potential bugs, so I flesh out and refine my algorithms all the time, and try to consider every eventuality in advance.

More than that, I comment my code as if my life depends on it. Seriously. And even moreso now that I commonly use phpdocumentor and Doxygen more. As such, I particularly appreciated an article on DevTopics.com, which lists “13 tips to comment your code“.

Programmers out there need to heed the advice and write better code! I know it’s normally not possible to make everything bullet-proof, and perhaps I try a little too hard in that regard, but massive chunks of unreadable code with no explanatory comments is not a good idea… no matter what your budget or schedule is like.

Even if you think you’re a good programmer, still check out those tips. Commenting your code is crucial, so go on! Just try it!

One Response to “Commenting your code”

  1. Chrono Defying Ninja Says:

    Did look at that article. And I am glad that I already do every step mentioned in that article.

    Could not agree with you more but also I would like to add a point.

    Planning your comments is essential also, there is no point in making something bullet proof at one layer when It does not need to be. If something in your code is already handled for it does need to be checked again on the same pass through.

    So remember all you programmers out there, plan your code first before you write it, taking any necessary planning stage steps like commented flowcharts and so on. This will result in you only writing your code once.

    So I can only reinforce, comment and comment wisely.