Perfecting OO’s Small Classes and Short Methods

Development

Reading Time: 1 minute

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.

Sign up for a free Codeship Account

Further Information

Subscribe via Email

Over 60,000 people from companies like Netflix, Apple, Spotify and O'Reilly are reading our articles.
Subscribe to receive a weekly newsletter with articles around Continuous Integration, Docker, and software development best practices.



We promise that we won't spam you. You can unsubscribe any time.

Join the Discussion

Leave us some comments on what you think about this topic or if you like to add something.