Programming Style and Expectations: Frequently Asked Questions (General)
- What should I put in my readme.txt file?Here is a readme guide.
- How should I format and comment my code?
- Here are some recommended style guidelines adapted from PU COS 226. Below are some that are particularly important (and for which you will lose points if you ignore):
- Include a bold (or Javadoc) comment at the beginning of each Java file with your name, login, date, the description of the program, and how to execute it.
- Include a comment describing every method and class (whether public or private).
- Include a comment describing every instance variable (including those for nested classes).
- Indent consistently, using 3 or 4 spaces for each indentation level. Do not use hard tabs.
- Do not exceed 80 characters per line. This rule also applies to the readme.txt file.
- Avoid unexplained magic numbers, especially ones that are used more than once.
- What is unit testing? It is testing of each method within a class. Ideally, it should be comprehensive enough to catch any error in the class.