Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • If there is an abbreviation in class name, you should use camel style for them as well. E.g. UserDao, not UserDAO.
  • If you can't imagine any adequate name for implementation of some interface, name it InterfaceNameImpl.
  • Interfaces shouldn't use I at the start, and abstract classes shouldn't start with A. Bad style: IFigure, ARoundFigure.
  • Both classes and methods should be named in a self-explanatory way. If the name is too long, you could shorten it and add more information to JavaDocs, but you should think thorought about these names, they are very important.
  • if, for, while - all this stuff should have curved braces {} surrounding their body, even if it's only one line of code.
  • There are two types of exceptions in Java: checked and unchecked, you should wisely use them in your code. Read JavaTalks FAQ (ru) and an article of Barry Ruzek to fully understand what types of exceptions should be used and when.
  • If you have a method with an empty body and you don't want/can implement it, you must throw UnsupportedOperationException in its body.
  • Put class fields and constants in the bottom of classes. Exception - domain entities or DTOs or other classes whose main intention is carrying data. (this is under discussion, but let's go this way at the moment).
  • While using BeanValidation, the property-level annotations should be preferred instead of field-leve. More details can be found in this JIRA.

...