Topic 5 of 12

Object Calisthenics

Nine exercise rules (proposed by Jeff Bay) that push you toward better object-oriented design. Not always to be followed to the letter — but great for practice.

What to study

  • Only one level of indentation per method
  • Don't use ELSE
  • Wrap all primitives
  • First-class collections
  • One dot per line
  • Don't abbreviate
  • Small classes (max. 50 lines)
  • At most 2 instance variables per class
  • No getters / setters

Videos5