Style Guidelines

  1. Good names for variables, constants, and methods.
  2. Consistent style (e.g., use of curly brackets).
  3. Good indentation.
  4. In your code you should leave one blank space between operators (e.g., x = 5 + 7).
  5. Make sure that you define values as constants when needed. For example, do not use variables for constants. Also, do not use numbers in your expressions if those numbers have a special meaning (e.g., 3.1415); instead define constants for them.
  6. You must avoid code duplication by calling appropriate methods (rather than cutting and pasting code). You may define your own private utility methods to perform often repeated tasks.
  7. Do not call static methods by using a class instance.
  8. You should avoid source lines exceeding 80 characters.
  9. Make sure you recognize when a field should be defined as private, protected, public or package.
  10. Remove from your code variables that are declared but never used.
  11. Remove any unnecessary import statements.
  12. The clarity of code can benefit from using empty lines between segments of code. Make sure you take this into account while writing your code. Similarly, comments in your methods are important in order to clarify what your code is doing. Make sure you provide such comments when needed.
  13. Simplify your code when possible. After implementing a method verify if it can be implemented in a simpler way.
  14. Feel free to use the Eclipse Format Element option (Source → Format).

Web Accessibility