Send Close Add comments: (status displays here)
Got it!  This site "www.robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.  Note: This appears on each machine/browser from which this site is accessed.
Abstraction and psychological chunking
by RS  admin@robinsnyder.com : 1024 x 640


1. Abstraction

2. Abstraction
Abstraction is looking at similarities and ignoring differences.

Abstraction 1
To abstract is to take away from the essentials and thereby to ignore certain differences.
The similarity is what is the same. The difference is what is different.

Human brains are built for complex abstraction.

The Latin word "abstractus""take away from". In abstract art, something is taken away, something remains, one needs to then interpret what is meant or intended.

Information sign More: Abstraction

3. Abstraction and psychological chunking
Part of the process of abstraction is what Hofstadter calls "psychological chunking". Hofstadter, D. (1979). Gödel, Escher, Bach: An eternal golden braid. New York: Vintage Books., p. 285-287.

Hofstadter relates how Adriaan de Groot performed studies of expert and novice chess players in the 1940's.

4. Chess chunking
Briefly, each was given a small amount of time to look at a chess board with chess pieces and then asked to reconstruct what they saw.

On board positions where pieces were placed such that they had realistic strategic meaning in a chess game, the beginners tended to make mistakes at random while the experts tended to place entire groups of pieces incorrectly, but with a somewhat similar strategic positioning. On the other hand, when the pieces were placed at random, the experts were found to be no better than beginners at reconstructing the board. One conclusion is that while the expert and the beginner see the same board, the expert chunks the information into a meaningful context. As such, the expert does not see bad moves.

5. Musical analogy, etc.
One would postulate that professional musicians can chunk entire phrases of music at a time, while beginning musicians may be stuck with one note at a time. And so on in other areas.

6. Programming language style
This same phenomena occurs in programming language notation. While the beginning programmer tends to be confused by rules of syntax, the experienced programmer is more concerned with semantics and can often, at a glance, take in an entire page of programming text, so long as it adheres to familiar guidelines of making us of white space such as blank lines and consistent indentation to reduce visual noise. Just like the expert chess player and the expert musician, the expert programmer simply does not see bad program syntax, greatly simplifying the task of programming.

7. Indentation rules
If you mix tabs and spaces, what looks good to you may not look good in other editors.


8. Good and bad style
Good style: Bad style:
main ... { while ... { if { } } }

main ... { while ... { if { } } }


9. Grouping and chunking parts of a program
Blank lines can be used to group parts of code that logically go together.

You should not use more than one blank line. It uses more rows on the valuable screen space and does not help much for chunking.

10. Consistent style
Use a visually consistent style. General rule: Do similar things in the same way.

11. Conditional statement
Avoid the single line if statement.
if (b) s1; else s2;

Always use the full if with braces and the else part if needed. Do not omit the braces.

Use:
if (b) { s1; } else { s2; }

Avoid:
if (b) s1; else s2;

For all advice: Unless you have a really good reason.

12. End of page

by RS  admin@robinsnyder.com : 1024 x 640