Java Class Checklist

  1. If this class is used by only 1 client, make it a private inner class of that client.
  2. Create Java class file
  3. Create Java class test file
  4. Add these files to version control repository
  5. Insert license preamble in both sources files
  6. Write some tests
  7. Is class or interface declared with minimum accessibility?
  8. Can class be declared final?
  9. If not, declare all methods final, initially. Make them protected/package-private, or public only as needed.
  10. Declarations should be:
  11. Assert all preconditions & postconditions that are not part of specification.
  12. Assert all method invariants.
  13. Log as needed.
  14. Make sure all code adheres to coding conventions.
  15. Javadoc! Yes, it's a verb too.
  16. Should the class be refactored? Are there design patterns that apply?