Tuesday, August 24, 2010

Style Standandards

2nd grade grading rubric All software companies have coding standards, either by decree or by default. These are just basic style rules that everyone must follow so that everyone else can more easily understand their code. Our style rules are based on those used by second graders. Namely
  1. You will put your name and email address at the top of every .java file. The more advanced among you can use the @author tag
  2. You will properly indent all your code. Control-a Control-i is your friend.
  3. You will write comments that describe what your code is meant to do but not comments that merely echo the code. That is: "calculate the marginal tax rate" is a good comment but "increase variable i by 5" is a bad comment.
  4. You will use proper English grammar in your comments.
  5. You will ensure that all variable names are spelled correctly. Misspelled variable names are a common source of bugs.
  6. You will choose good variable names: i is reserved for simple loops, otherwise the variable should describe its contents, in camelCasing, such as bookTitle or netProfit.
  7. Your code will be neat.

Computer majors might want to take a look at our CSCE 240 programming style sheet to learn in more detail about style rules.

No comments: