Short Methods and Small Classes

|

If you're used to writing & reading long methods, dealing with small methods & classes can take some time to get familiar with. Keith Ray has a great writeup on Reading Short Methods and Small Classes.

He also cites Jerry Weinberg's great test to determine if a function/method is too long:

  1. Pick a function.
  2. Understand it, what it's supposed to do, how that is accomplished.
  3. Memorize the function.
  4. Then, without looking at the original code, write the function from memory.
  5. If you've made a mistake, the function was too long, or otherwise too complex.

About this Entry

This page contains a single entry by HMK published on March 30, 2006 5:26 PM.

Marketing Biathlon was the previous entry in this blog.

Variable/Function/Object/Class naming is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.