First page Back Continue Last page Overview Text


The psychologist George Miller in his 1956 paper “the magical number 7+/-2” identified that short term memory is capacity limited. There is evidence to show that rather than 7+/-2 this limit is around 4 chunks.

Beck and Cunningham’s CRC model advises that a class have no more than 2 or 3 collaborators. Effectively chunking the view of relationships to no more than four elements

Many refactoring rules introduce indirections to chunk classes.

As can be guessed from the name elements in short term memory have a limited lifespan unless they are rehearsed. Experiments have shown this to be the order of seconds. A short walk up the stairs (if we don't rehearse) is long enough for us to forget why we went up there in the first place

Traversing a layer of indirection in the code may have both time and capacity penalties for STM. For example switching to another class to examine the workings of a called method may take a few seconds (seconds count with STM). Each level that is traversed may need to be understood (including peripheral items), taking up STM capacity and pushing the original contents out where they can no longer be rehearsed. We are remarkably adept at chunking all this information to keep a few levels still in STM. However, there is a limit, for which there will be no warning. Just a realization that we no longer remember how or why we got to this part of the code.

Indirection is a useful mechanism for chunking but the cognitive model also identifies a cost associated with it.