Code Farms Inc

1.6 THE HUMAN BRAIN DOES NOT LIKE GENERAL GRAPHS


This section is of a less technical nature. It discusses the psychological reasons why it is easier to understand Programs based on acyclic graphs such as lattices or trees, rather than general graphs which contain cycles.

As mentioned above, cycles (feedback loops) increase the complexity of all systems, including software. Based on my empirical observations, cycles make software much more difficult to understand, maintain, and debug. The success of structured programming definitely points in this direction. Naturally, we can ask: Is there a theoretical reason behind all this? Why would our brain prefer one organization to another?

Minsky ([MIN], 15.10) shows that when solving a complex problem, our memory keeps a stack of subjobs that must be executed. The brain contains a relatively small but fast short-term memory, and a big long-term memory for permanent storage.

Typically, problems are solved mostly in short-term memory. Retrieval from the main memory is relatively slow, ranging from minutes to hours ([MIN], 15.8). If there are too many subjobs to fit the short-term memory, some of them overflow into the long-term memory, and the brain starts to lose track of what it is actually solving.

Another important aspect of brain operation is that the brain remembers patterns. For example, operations on trees (and especially on binary trees) are easy to handle, because we remember the pattern: each parent element has two children (left and right). If we work with a graph that has exactly 4 edges connected to every vertex, the task is easier than dealing with an irregular graph which has, on average, only 3 edges per node.

Figure 1.7 When moving from node i to node k, the size of an update depends on the complexity of the organization: (a) simple sequences, (b) binary tree, and (e) more complex organization.

Perhaps due to this internal organization, the brain works best with hierarchies which map onto trees ([MIN], 10.9), and not onto general networks. This may also be a matter of information content. When using a hierarchical representation, there are fewer objects to consider. Many recreational puzzles and games, such as chess or the Japanese game of GO are based on traversing large networks without a regular pattern, and are therefore difficult to solve.

One may disagree, but specialists on computer interfaces have come to the conclusion that short-term memory is relatively small. When the number of options on the screen (window menu) exceeds 10, many users feel uncomfortable.

When we read or debug a computer program, we simulate its execution in our mind. This is a dynamic process. At any given time, we have to remember the current state, how we got there (recent history), and the options that lead to the next state.

The examples in Figure 1.7 show how the structure of the program affects the memory required for this thinking process. In Figure 1.7, nodes of the graph represent blocks of code or function calls. In all three cases, we assume that after analyzing the situation at node i, we transfer to node k. We also assume that the fast memory can keep up to 7 nodes.

If the program consists of a simple sequence of blocks (Figure 1.7a), we can keep track of a relatively long history. Also, moving to the next node results in only a small change in what is being remembered: 1 new node, 1 new relation.

For a binary tree (Figure 1 .7b), the move to the adjacent node causes a slightly larger disturbance: 2 new nodes, 2 relations.

For a graph where each node connects to 6 other nodes (Figure 1.7c), the fast memory an keep track of the immediate situation only. Moving to the next node causes a major hange: 4 new nodes, and 7 new relations have to be processed.

Simon [SIM] observed that successful complex systems have certain common characteristics. One of them is that they are hierarchical. The other is that they are nearly decomosable, meaning that interactions among subcomponents are fewer than those within the me subcomponent level.

All this agrees with Meyer's principle of "few interfaces," see [MEM, p. 19. Note that if e graph connects one node to more than 6 other nodes, the fast memory cannot keep ack of even the most immediate situation, and we start to get lost. In real life, the limit rhich we have assumed to be 7 may differ from person to person, and may also depend on ow much information is associated with each state (or node).

In spite of extensive research, we still know very little about how the brain actually orks. Perhaps the brain simulates certain organizations by connecting internal circuits in e same pattern. Were that true, general networks that contain cycles could possibly cause scillations, thus creating confusion in the perception of the problem.

Code Farms Inc | www.codefarms.com | info@codefarms.com