Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

View Poll Results: Do you comment your code?
All the time 17 29.31%
Sometimes 35 60.34%
Never 5 8.62%
Commenting? 1 1.72%
Voters: 58. You may not vote on this poll

Reply
 
Thread Tools Display Modes
Old May 24th, 2006, 11:10 PM   #21
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
When I code I write a classes header file first, then comment the class, its member functions and variables in doxygen style. Then I actually write the class. This is followed by a unit test suite that tests to make sure every method of the class does what the documentation says it does. This is all quite helpful in forcing you to design your classes well. This all goes along with proper variable and function naming.

I would like to say the people who claim there code is "self-documenting" have not come back to code they wrote a long time ago. Self-documenting is true for body of simple functions, but you can't expect a function name to convey as much information as this. Ogre is quite a good project to see how a pretty well written, documented and layed out project should look like.
Game_Ender is offline   Reply With Quote
Old May 24th, 2006, 11:13 PM   #22
msk420
Programmer
 
msk420's Avatar
 
Join Date: May 2006
Posts: 85
Rep Power: 3 msk420 is on a distinguished road
New guy sounds smart.... Welcome to the PFO forums...
__________________
Code Forums
msk420 is offline   Reply With Quote
Old May 24th, 2006, 11:21 PM   #23
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Quote:
Originally Posted by msk420
New guy sounds smart.... Welcome to the PFO forums...
I have been scared straight by looking at several awful C++/C applications. All you have to do is spend several plowing threw it before you want to just sit down and rewrite the whole thing. After all, what decent engineer doesn't stare at a system and think they can do it better . That said it really does take quite some time to do the whole the Document-Code-Test cycle, but at least it gives you a safety net. Most of the stuff I code has to be used by other people, so the more copious my documentation and testing the more effective it will be.
Game_Ender is offline   Reply With Quote
Old May 24th, 2006, 11:29 PM   #24
msk420
Programmer
 
msk420's Avatar
 
Join Date: May 2006
Posts: 85
Rep Power: 3 msk420 is on a distinguished road
I agree. The apps I work with/on are used by other people and if they need to look at the source and its not commented they have no idea what I am talking about.
__________________
Code Forums
msk420 is offline   Reply With Quote
Old May 24th, 2006, 11:50 PM   #25
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
I comment everything!!!! line by line, even if it's wrong to do so.

This is mainly due to the fact that I have a horrible memory and so the comments help me remember what I'm doing.
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Old May 24th, 2006, 11:51 PM   #26
msk420
Programmer
 
msk420's Avatar
 
Join Date: May 2006
Posts: 85
Rep Power: 3 msk420 is on a distinguished road
Good practice I guess...
__________________
Code Forums
msk420 is offline   Reply With Quote
Old May 24th, 2006, 11:59 PM   #27
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
I'd say overcommenting is actually not good. While you can definitely see what your code does later, well, if you need the comments on every line later, you might not want to be programming much. But even when you're first writing the code, if you comment each line, you're spending a rough estimate of 30-50% of your coding time writing comments. Not particularly efficient. That's not to say that spending a certain amount of time on commenting is bad, but there's such a thing as too much.
Jimbo is offline   Reply With Quote
Old May 25th, 2006, 12:34 AM   #28
msk420
Programmer
 
msk420's Avatar
 
Join Date: May 2006
Posts: 85
Rep Power: 3 msk420 is on a distinguished road
True I see your point.
__________________
Code Forums
msk420 is offline   Reply With Quote
Old May 25th, 2006, 2:24 AM   #29
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Quote:
Originally Posted by Game_Ender
I have been scared straight by looking at several awful C++/C applications. All you have to do is spend several plowing threw it before you want to just sit down and rewrite the whole thing. After all, what decent engineer doesn't stare at a system and think they can do it better . That said it really does take quite some time to do the whole the Document-Code-Test cycle, but at least it gives you a safety net. Most of the stuff I code has to be used by other people, so the more copious my documentation and testing the more effective it will be.
That's my code you're talking about. That is why I started commenting.
Harakim is offline   Reply With Quote
Old Jun 3rd, 2006, 3:39 PM   #30
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Quote:
Originally Posted by Jimbo
I'd say overcommenting is actually not good. While you can definitely see what your code does later, well, if you need the comments on every line later, you might not want to be programming much. But even when you're first writing the code, if you comment each line, you're spending a rough estimate of 30-50% of your coding time writing comments. Not particularly efficient. That's not to say that spending a certain amount of time on commenting is bad, but there's such a thing as too much.
That's true. However, I comment a lot because my teacher gives the class a communication mark based on the amount of comments we have.
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:44 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC