The Role of Working Memory in Program Tracing

01/15/2021
by   Will Crichton, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/26/2021

A Program Instrumentation for Prefix-Based Tracing in Message-Passing Concurrency

The execution of concurrent programs generally involves some degree of n...
research
02/08/2022

Automated Instantiation of Control Flow Tracing Exercises

One of the first steps in learning how to program is reading and tracing...
research
04/11/2023

Program Comprehension Does Not Primarily Rely On the Language Centers of the Human Brain

Our goal is to identify brain regions involved in comprehending computer...
research
07/10/2023

Can You Improve My Code? Optimizing Programs with Local Search

This paper introduces a local search method for improving an existing pr...
research
03/24/2023

The First Computer Program

In 1837, the first computer program in history was sketched by the renow...
research
04/11/2023

Tracing OCaml Programs

This presentation will cover a framework for application-level tracing o...
research
11/08/2022

Focused Dynamic Slicing for Large Applications using an Abstract Memory-Model

Dynamic slicing techniques compute program dependencies to find all stat...

Please sign up or login with your details

Forgot password? Click here to reset