English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2007-05-20 18:32:31 · 7 answers · asked by SoldierSide 1 in Computers & Internet Programming & Design

Those of you who said you should comment as you go are probably right. I just wrote a complex code and 15 minutes after i wanted to comment and I couldn't make out what the hell's going on lol

2007-05-20 18:56:43 · update #1

7 answers

Always, always, always write your comments as you go. Otherwise, you will forget key details, leaving the thing a mystery to another reader -- or even yourself.

2007-05-20 18:52:12 · answer #1 · answered by Anonymous · 0 0

It's really a matter of preference. Some people get through a block of code much faster and know exactly what is what if they leave out the commenting, or leave it to a minimum. Some people just must comment everything as they go. In the log run however, (depending on who you work for of course) commenting is always second to getting the product out and the money in. This isn't what we programmers would recommend, but money is money, and publishers don't understand the need for comments. They think they pay you to know exactly what is going on with a quick glance at even the most obfuscated code.

2007-05-21 01:44:42 · answer #2 · answered by SubOne 3 · 0 0

I found that if i left it until after (even on bigger apps) I would either forget about it, or just not want to do it, so i had to learn to right it as i went.

On the odd occasion that i did get around to it, i would find code that i couldnt remember what it did, so i would have to follow it through until i found its purpose, then go back and write the comment, thus adding time to an already long (and painful) job

2007-05-21 01:40:43 · answer #3 · answered by thunderbox666 3 · 0 0

During. You'll have no idea what your state of mine was after the fact. You'll probably never actually get around to it. You should get into a habit of just making commenting a part of writing the executed code, not some annoying task that has to be done because someone tells you to or because you've heard it's good.

2007-05-21 01:38:02 · answer #4 · answered by Evan G 2 · 2 0

Hi. I agree with Evan G. Always better to make at least SOME notes during coding. You can always change the wording later.

2007-05-21 01:41:05 · answer #5 · answered by Cirric 7 · 0 0

I'm adding my agreement to the above, for all the reasons given. On small programs, I typically write the comments first and use that as my program outline.

2007-05-21 01:42:55 · answer #6 · answered by Ken H 4 · 0 0

always comment as you go.

//Get input
Code
code
code

//check for validity
Code
code
code

//Check something
code

Tell yourself as you go and at each step in your process, insert comments.

Sometimes I will even pseudo code then leave the pseudocode as my comments.

2007-05-21 20:08:11 · answer #7 · answered by Jeffrey F 6 · 0 0

fedest.com, questions and answers