Saturday, March 31, 2012

The middle memory

kw: musings, memory, thinking

I love it when a book gets me thinking. I reviewed How to Think Like a Neandertal, by Thomas Wynn and Frederick L. Coolidge, yesterday. A portion of their discussion of Neandertal cognition was memory.

Usually, memory is considered to have two varieties, long term and short term. Short term memory can hold a phone number, or someone's name, or a short list of items, for a few seconds, up to a minute or so. Repetition of a short-term memory, or a sudden shock, can fix it in long term memory, which lasts decades. But another term came up in the discussion of tool making and expertise: working memory. It wasn't really quantified.

Is working memory some combination of short- and long term memory, or something distinct? It seems to work this way. When you are engaged in a task, particularly one which is not wholly familiar, you may have to hold several things in memory for periods of minutes to hours. Yet, once you are done, all the memories fade.

I took advantage of this whenever I wrote a computer program or subroutine. In the very early days, I did what beginning programmers usually do, and built stand-alone applications (today folks just call them apps). They consisted of a stack of FORTRAN code that just did what I wanted it to do, usually. Whether extract certain numbers from a list or calculate a Fourier series, I just set it all up to do what I wanted. While I was writing, particularly in the days of the card punch (no terminal screen to help), I kept the entire program in mind as I spun out the code, line by line.

As time went on, I learned to break up a process into chunks, and write the chunks one at a time. I began to rely on callable routines. Eventually, I could write a program with a general outline:
Program dostuff
Call Askfordata
Call Crankonthedata
Call Printresults
But this just deferred the situation. The core of the work was in routine Crankonthedata, and it could be quite involved, with hundreds of lines of code. Sometimes I could break it up further, but there is a limit to "chunking" a problem. Sooner or later, you have to make it all go.

There was another technique I learned to rely on. As problems I needed to program got harder, it would take several days to write a routine. By such a time, I was pre-writing not the program code, but a flow chart of its operation, and spinning out the code for each block of the flow chart as I came to it. Inevitably, something would not work right, or I'd come to a section and find out I hadn't thought it through sufficiently; there were some dangling threads in the logic that I had to tie up. So at the end of the day, I learned to "grok" the whole routine I was working on, sort of hang the whole thing on a mental blackboard, and go to sleep on it. In the morning, I'd have a batch of stuff ready to write, and it could take half the morning to catch up.

By the way, I always wrote lots of comments in my code, something not all programmers do. Do you know why? I found out that if I looked at the routine just a couple of weeks later, I had no idea what was going on, unless I had good comments to help me decipher what I had written! All trace of the memory was gone. Somehow, a detailed memory, with thousands of parts, that I could hold onto for a few days, would still not make it into long term memory.

Perhaps that's a blessing. I wonder whether my brain would be full now, if I could remember every line of code I wrote over a forty year career. As I've written elsewhere, I used to produce 500-1000 lines a week of FORTRAN. With an average usable "year" of forty weeks (nobody works a 52-week year), that comes to a million lines of code or more.

I once met a pianist who claimed to be nothing special in the memory department, but he typically prepares for a concert by learning 100-150 pages of music. He performs strictly from memory. When he is getting ready for the next concert, any pieces he is not repeating have to be learned. The rest he mostly forgets, though he has a core repertory of a few hundred pages of music that he performs more often.

So what is working memory? It seems to be a forgettable memory store with a medium period, up to a few days or a couple of weeks. If things like FORTRAN code were stored as compactly in the brain as they are on a hard disk, my million lines of FORTRAN might total no more than fifty megabytes. These days, that's about a third of a square millimeter on the surface of a hard disk (the disk in my current computer stores 100 Gby per square inch, or 155 Mby per square mm). Somehow, we may store much more than this about many things, but not everything. I am awed.

No comments: