November 13, 2011

Object Calisthenics

Yet again I come here to share something learned from very smart people. Initially when I saw these rules my head exploded. Even though they are reasonable rules, they break the traditional non-object-oriented I've been doing for a while.



  1. One level of indentation per method
  2. No else keyword
  3. Wrap all primitives and strings
  4. Use only one dot per line
  5. Don’t abbreviate names but keep them short
  6. Keep all entities small
  7. No more than two instance variables per class
  8. Use first-class collections
  9. Don’t use any getters/setters or properties
I'm still trying to wrap a prototype project around them, and the partial results are astonishing.

Sources