Vous êtes sur la page 1sur 3

Page 1 of 3

1. REFERENCE.............................................................................................................................................2

2. CHECKLISTS............................................................................................................................................2

2.1 GENERAL JAVA CHECKLIST...............................................................................................................................2

1. Reference
DCR Number # :

Name of the Work :

2. Checklists
2.1 General Java Checklist
CHECKLIST ITEM CHECKED (Y/N) REMARKS
All classes should be public
No attribute should be public
Classes should be final only if there is no possibility of extension
There should be no unused variable declarations or members or
methods
There should not be a default constructor that does not do anything
No main method should be there
No System.out.println in code
Check for nullity of an object before operating on it
Clone the object parameters before using it
The termination condition of a for-loop should not involve method
invocation or expression evaluations (Other than necessitated by the
termination condition)
Unnecessary methods should not be present in the code.
All the methods overloaded from base classes by the program should
be mentioned at the top of the java source file. This is not required for
the overloaded methods of java e.g. paint.
String comparison should be done using only the methods provided in
the String class.
For objects,(esp. Vector objects) direct assignment should not be used.
Instead clone should be used
In any method if multiple exclusive conditions are checked else if
should be used instead of multiple if statements or switch statement.
Prefer local variables to class attributes
Show proper messages to user on catching exception
Include comments only if necessary
Avoid overloaded methods in same class
Reduce coupling between classes
No magic numbers should be there in code.

Page 2 of 3
CHECKLIST ITEM CHECKED (Y/N) REMARKS
Pass constants instead of string literals to methods
Method names should be indicative of what the method is doing
Every java file should have a header with at least Author or current
owner, and a small description of the class.
Include proper comments about parameters and return value
Include proper comment about vectors passed as parameters
Get/set methods for the same variable should have consistent names.
Avoid Duplication of code
Give meaningful name for booleans
Avoid comparing boolean through == or != in conditional statements .
Use (boolean) or (! Boolean) instead

Page 3 of 3