ComputerScience
TeachingAssistant
gradePrograms()
numStudentsInClass
favoriteCheese_ or _favoriteCheese
PAY_RATE
Please try to avoid variable and method names that consist only of one
letter, or are otherwise non-descriptive. Something like
myVar.myMethod(a) provides absolutely no useful information. And that's bad.
Helpful Hint: Comment as you go along, do not leave all your commenting until the end of the project. The last thing anyone wants to do after they get their program working is go back and comment.
/**...*/) for header comments. You should describe each class and it's design in the header comment. Remember to put your name and your account number at the top of each file. Your Applet class should contain a header comment that describes the design of the entire program. Here you should also
indicate if your program has any bugs in it.
Example:
Every method should also have a header which contains a comment describing its purpose and how it achieves its purpose and a list of variables passed to and/or modified by the method. If the method returns a value or takes parameters, this should be described in the header as well. The more detailed the description, the better.
* Class: Smurf
* Package: SmurfVillage
* This class models a generic Smurf. It contains references to a
* SmurfHead, arms, legs, and a hat, because all of those are
* parts of a Smurf, and should be contained within the Smurf
* class. This is the superclass that will be used for the other
* Smurf classes (eg. PapaSmurf, HandySmurf, etc). Most of the
* code for the Smurf methods will be in this class, to avoid
* repeating it in the subclasses.
*/
Example:
* Method: performSmurfMagic
* class: Smurf
* Parameter: MagicItem - the item needed to do the magic
* This is the default performSmurfMagic method. Since all smurfs
* are able to perform a little magic,this method need not be
* changed in the subclasses. Only the PapaSmurf class, which can
* perform magic better than your average Smurf, will need to
* redefine this method.
*/
// commenting style for
glossaries. Example:
public class CSFive extends ComputerScienceClass {
// commenting style for inline comments. Lines should
be commented to describe what they are doing. Note that this comment
should not just repeat what the Java code does, but sho uld elaborate on the code. This should be done for every section and
logical chunk of code.
Examples:
time++; //add one to time |
<- Useless |
time++; //update clock to current hour |
<- Useful |