Object calisthenics rules


#1
  1. Only one level of indentation per method.
  2. Don’t use the ELSE keyword.
  3. Wrap all primitives and strings (wrap primitive types in classes).
  4. First class collections (wrap collections in classes).
  5. One dot per line.
  6. Don’t abbreviate.
  7. Keep all entities small.
  8. No classes with more than two instance variables.
  9. No getters/setters/properties.
  10. All classes must have state.

Heuristics

  • Tell don’t ask
  • Law of Demeter