Talk:BASIC in Print and in Memory
From Maze
Michael's Comments on Programming Plans
In the psychology of programming literature, an important concept is the code plan. These are abstract plans for code constructs that are realized into different constructs for different languages. Eliot Solloway did alot of the earlier work on code plans. In contrast to the Raven work you cite about domains (memorization involves connection/correspondance to a real world domain), the code plan literature talks about both program production and comprehension in terms of these abstract plans. This is applicable to one line programs (there's an infinite loop operating, etc.) and doesn't suffer from the "what is the domain of expressive computing" problem. Not sure how far you'd want to go down this path, but pointing out that there are much more sophisticated cognitive accounts of programming than the ones you cite.
My masters thesis in 1992 involved the implementation of a dynamic code documentation system (The Intelligent Code Object Planner) in which the system automatically generated example code snippets for using a particular API based on natural language queries. It had a formal model (frame representation) of the API - the NLU system (modeled on what Winograd did for shrdlu) turned NL queries into programming goals, specialized planning reasoned over the frame-based knowledge base to devise an abstract plan for accomplishing the query, and a unification grammar turned the abstract plan into concrete code in a specific language. The API the system knew about was a subset of Windows 3.0 and the concrete language it could realize snippets for was C. So you could ask things like "How do you draw an icon" or "How do you close a window" or "How do you get a handle to widget" and it would dynamically generate a code snippet in C showing you how to do it (including non-contiguous code). Anyway, it was in the context of building this system that I became very familiar with the cognitive science accounts of programming competence (circa 1990).
Here's a nice bibliography of work on psychology of programming, with many references to programming plans (as they are the dominant account of program comprehension and production): http://www.cise.ufl.edu/research/ParallelPatterns/PatternLanguage/Background/Psychology/Psych-bibliography.htm.
Michael, this is good to know and we'll want to mention the existence of more sophisticated models if that paragraph on Ruven stays in. (It doesn't really speak to the core of this section, but it seemed like an interesting opportunity to point out how 10 PRINT is an outlier and how theories about industrial programming don't apply to it.) But the main discussion here is about the memorization of programs. Do any of these papers deal with that? I didn't see from the annotations in the bibliography that they do. -Nick
Look for abstracts that talk about program comprehension. Many program comprehension tasks involve memorizing the program. For example, in "Mental representations of programs by novices and experts" by Fix, Wiedenbeck and Scholtz (http://portal.acm.org.oca.ucsc.edu/citation.cfm?id=169059.169088&coll=ACM&dl=ACM&CFID=96919946&CFTOKEN=26471234), subjects are given a 135 line pascal program to study (no comments or documentation) - the program is taken away, and they are asked a series of questions about the program to test how deeply they understood the program (which of course involves having memorized at least some aspects of the program). Memorization and programming plans are intimately related. In this psychological theory of programming, what makes an expert programmer an expert is the accumulation of programming plans. Experts will be able to memorize programs more effectively than novices because, instead of memorizing meaningless word and character-level sequences, they are recognizing and memorizing more abstract programming plans, which they re-concretize if asked to reproduce the program. Of course, multiple concrete representations exist for the same instantiated abstract plan(s), which, they theory predicts, could cause a programmer to reproduce a program that accomplishes the same abstract plans, but may use different low-level details than the original program, which is exactly what happened to you in your re-creation of 10 Print.
Here is a draft of a 1995 article on program comprehension from the Encyclopedia of Computer Science and Technology that talks about the relationship between memorization and comprehension, and also talks about Schneiderman's work, which you do cite: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.51.1404&rep=rep1&type=pdf.
