CS5 Programming Style Guidellines
- Use of indenting and consistent indenting (pick something reasonable and stick to it!)
- Header comments: include your name (and your partner's if pair programming),
the file's name, the date, and a general comment of the file's purpose. Notes
for graders can also be included there.
- Code comments: comment each method (function) you write indicating its
purpose. Within your code, add comments to describe at a high-level
what is going on. Comments don't need to address every line -- include them as
needed to generally describe how your code works.
- Balance your choice of variable names between easy-to-use
(short) and easy to understand (descriptive). If you like using one-letter
names, be sure to comment what they are (except for common practices like
i or j for loop indices).
- Use whitespace liberally! White space should indicate higher-level
structure at a glance.
For an example of good style, see rand_loop.java.