Commenting |
Comments are extremely important. Take some care to write accurate yet concise comments.
You should write comments for each:
For each class or object expression, please include a brief paragraph explaining what it does (what is more important than how here). This comment should also explain any parameters used in the class definition.
If the method code is simple you do not need to comment in the method body. If the method body is complicated, you might want to add some comments to certain blocks of code that you deem to be complicated, e.g., the different branches of an if-else statement, or what a loop is accomplishing. Be careful not to over-comment!
For method headers the style is:
// Tell what the method should do (but not how!) // explain what each parameter represents // explain what is returned if the return type is different from Done
Commenting |