nightsurge said:
Good you can answer a very big question of mine. Something that's been annoying me for ages now. In the professional setting, how big of a deal was commenting, and how thoroughly did you have to do it? It seems like each new CS professor I have, they introduce a different guide for commenting, and they all place differing levels of importance on it. One class didn't require much at all. One class wanted comments every single line. The current class I'm in wants us to use JavaDoc and that seems like the most commenting and way more than necessary.... |
Depends on the language, how you write your code and company requirements. Personally, I would say get in the habbit of writing a lot of comments as it makes it easier in the long run.
If it is Assembly, then 1 comment every line is incredibly helpful as it is a pain to decrypt what someone else wrote. If you use abriviations, again comments are incredibly useful and should be plentiful. If you never use abriviations (my favorite way of writing code) then comments before every logical section makes sense. So maybe comments before a section that setup and execute an FFT on a data set, then another comment before sending the results to a display.
At a minimum you should have comments for the function description, inputs, and outputs for every function, and comments for what the variables are meant to be used for.








