The Role of Working Memory in Program Tracing

被引:4
作者
Crichton, Will [1 ]
Agrawala, Maneesh [1 ]
Hanrahan, Pat [1 ]
机构
[1] Stanford Univ, Stanford, CA 94305 USA
来源
CHI '21: PROCEEDINGS OF THE 2021 CHI CONFERENCE ON HUMAN FACTORS IN COMPUTING SYSTEMS | 2021年
关键词
Program tracing; program comprehension; working memory; restricted focus viewing; SHORT-TERM; COMPREHENSION; RETRIEVAL; CAPACITY;
D O I
10.1145/3411764.3445257
中图分类号
TP39 [计算机的应用];
学科分类号
081203 ; 0835 ;
摘要
Program tracing, or mentally simulating a program on concrete inputs, is an important part of general program comprehension. Programs involve many kinds of virtual state that must be held in memory, such as variable/value pairs and a call stack. In this work, we examine the influence of short-term working memory (WM) on a person's ability to remember program state during tracing. We first confirm that previous findings in cognitive psychology transfer to the programming domain: people can keep about 7 variable/value pairs in WM, and people will accidentally swap associations between variables due to WM load. We use a restricted focus viewing interface to further analyze the strategies people use to trace through programs, and the relationship of tracing strategy to WM. Given a straight-line program, we find half of our participants traced a program from the top-down line-by-line (linearly), and the other half start at the bottom and trace upward based on data dependencies (on-demand). Participants with an on-demand strategy made more WM errors while tracing straight-line code than with a linear strategy, but the two strategies contained an equal number of WM errors when tracing code with functions. We conclude with the implications of these findings for the design of programming tools: first, programs should be analyzed to identify and refactor human-memory-intensive sections of code. Second, programming environments should interactively visualize variable metadata to reduce WM load in accordance with a person's tracing strategy. Third, tools for program comprehension should enable externalizing program state while tracing.
引用
收藏
页数:13
相关论文
共 35 条
[1]  
Anderson J., 1985, Hum. Comput. Interact., V1, P107
[2]  
[Anonymous], TRENDS COGNITIVE SCI
[3]   LOCUS OF DIFFICULTY IN MULTISTAGE MATHEMATICS PROBLEMS [J].
AYRES, P ;
SWELLER, J .
AMERICAN JOURNAL OF PSYCHOLOGY, 1990, 103 (02) :167-193
[4]   Systematic mathematical errors and cognitive load [J].
Ayres, PL .
CONTEMPORARY EDUCATIONAL PSYCHOLOGY, 2001, 26 (02) :227-248
[5]   Working memory [J].
Baddeley, Alan .
CURRENT BIOLOGY, 2010, 20 (04) :R136-R140
[6]  
Bragdon A, 2010, CHI2010: PROCEEDINGS OF THE 28TH ANNUAL CHI CONFERENCE ON HUMAN FACTORS IN COMPUTING SYSTEMS, VOLS 1-4, P2503
[7]   Eye Movements in Code Reading: Relaxing the Linear Order [J].
Busjahn, Teresa ;
Bednarik, Roman ;
Begel, Andrew ;
Crosby, Martha ;
Paterson, James H. ;
Schulte, Carsten ;
Sharif, Bonita ;
Tamm, Sascha .
2015 IEEE 23RD INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION ICPC 2015, 2015, :255-265
[8]   AGE-RELATED DECLINES IN WORKING-MEMORY SKILLS - EVIDENCE FROM A COMPLEX CALCULATION TASK [J].
CAMPBELL, JID ;
CHARNESS, N .
DEVELOPMENTAL PSYCHOLOGY, 1990, 26 (06) :879-888
[9]  
Cousot Patrick, 1977, POPL, P238, DOI DOI 10.1145/512950.512973