Perfecting OO's Small Classes and Short Methods

Written by: Manuel Weiss

I recently stumbled upon Andrew Binstock's great article about OO's Small Classes and Short Methods in which he summarized Jeff Bay's essay "Object Calistehnics". Andrew is Editor-in-chief at Dr. Dobb's and lead developer for Platypus, an OSS typsetting software. You can find Andrew on twitter.

If you want to improve your ability to write OO routines have a look at this exercise by Andrew.

A great exercise to improve Object Oriented Style Coding

  1. Use only one level of indentation per method.

  2. Don’t use the ‘else’ keyword.

  3. Wrap all primitives and strings.

  4. Use only one dot per line.

  5. Don’t abbreviate names.

  6. Keep entities small.

  7. Don’t use any classes with more than two instance variables.

  8. Use first-class collections.

  9. Don’t use setters, getters, or properties.

If you want to read a more in-depth article about this exercise I highly recommend you head over to Andrew's original article.

Further Information

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.