First page Back Continue Last page Overview Graphics

4 minus Analogies Rule


Notes:

....software should be chunked in elements of four (or fewer) after allowing for any number of varieties of analogies.

This is applicable at all levels. Statement expressions within a statement. Statements within a group, groups of statements within a method. This is not to say all classes should have at most four methods. Rather, the methods should be grouped within the class to chunks of no more than four (after allowing for analogies).

Chunking software elements is fairly obvious and is mentioned in many texts. Explaining the permissible exceptions using a simple consistent rule is not

For example the visitor pattern allows many methods in a class but they are varieties of the visitor analogy.