Course Coding Standards CS 2530
|
There are a few programming standards that we will follow in this course. I will try to follow them in all the code I give you, unless I mention that the code is a special case for demonstrating a specific point. I expect you to follow them in all the code you give me.
private int initialFuel;
public class LunarLander() { ... }The specification may require other constructors as well.
private int initialFuel; public class LunarLander() { initialFuel = default_value; }
Do not initialize instance variables in their declaration.
// don't initialize here... private int initialFuel= default_value; public class LunarLander() { // ... even if you initialize here initialFuel = default_value; }
Feel free to ask for the rationale behind any standard. (I will explain many in class, but perhaps not all.)
Document each file with a header block that includes at least:
Here's an example:
// // FILE: Ball.java // AUTHOR: Eugene Wallingford// DATE: 01/31/2012 // COMMENT: Factored out of Budd's Ball class state and paint behavior. // // MODIFIED: 03/08/2012 by Eugene Wallingford // CHANGE: Added a getColor() accessor. //
Your block need not look exactly like this, but it should contain the same information.
I do not require you to follow a lot of specific style rules, but I do ask you to follow several basic guidelines to improve the readability of your code.
for (int i = 0; i < 10; i++) System.out.println( i );
instead of this:
for (int i = 0; i < 10; i++) System.out.println( i );