DevelopPHP.com 2010 Discussion Archive(not active)

 

Forum Index >> General Forum

leaving in code comments
   THREAD CLOSED
leaving in code comments
by Devin0 - Sun Feb 13, 2011 10:53:51 AM
is it good practise to leave in code comments in you code, that is 
being used live on the web, just thought i would ask some people
opinions . 

let me know people and happy coding .....

RE: leaving in code comments
by lewisanderson - Sun Feb 13, 2011 11:11:35 AM

I usually do, that way when I kick the bucket or end up in a killing spree and am sitting in solitary, the next developer can pick up where I left off with little downtime

especially with the css, saves so much time to comment it out for future changes


RE: leaving in code comments
by AlanJhonnes - Sun Feb 13, 2011 01:14:47 PM
I hardly comment CSS unless its some kind of neat trick which needs some explanation lol.
For html, its good to comment where each main div starts and ends so its easier when you're editing the code.
Javascript, always good to comment because usually its not just the javascript code you're interacting with, but also the CSS and HTML, so what the code is doing is not so obvious at first glance without looking at the css and html also.
For actionscript, I only comment the complex parts, especially the ones with heavy math.


RE: leaving in code comments
by pch - Sun Feb 13, 2011 02:37:07 PM
Usually I only comment Javascript. Especially when writting custom functions. If you go back to them months later, you'll be banging your head thinking what they actually do. But for css, I never actually comment. Only maybe a comment telling what the followings rules style (e.g. header, footer). Also for html, I hardly every comment except when the document gets very long. Then it may become a pain to understand what element is nested is what. But when the site goes live, I usually remove them or keep a 'dirty' version and upload the clean version without the comments.

   THREAD CLOSED  
©2009 DevelopPHP.com