Survey Paper 4
Survey Paper 4
net/publication/220817999
CITATIONS READS
72 344
2 authors, including:
Brad A. Myers
Carnegie Mellon University
519 PUBLICATIONS 25,962 CITATIONS
SEE PROFILE
All content following this page was uploaded by Brad A. Myers on 29 May 2014.
1-1-2003
Brad A. Myers
Carnegie Mellon University
Recommended Citation
Ko, Andrew J. and Myers, Brad A., "Development and Evaluation of a Model of Programming Errors" (2003). Human-Computer
Interaction Institute. Paper 184.
http://repository.cmu.edu/hcii/184
This Conference Proceeding is brought to you for free and open access by the School of Computer Science at Research Showcase. It has been accepted
for inclusion in Human-Computer Interaction Institute by an authorized administrator of Research Showcase. For more information, please contact
kbehrman@andrew.cmu.edu.
Development and Evaluation of a Model of Programming Errors
Proceedings of the IEEE 2003 Symposia on Human Centric Computing Languages and
Environments (HCC’03), Auckland, New Zealand, October 28-31, pp. 1-8. © 2003 IEEE
3. Classifications and Causes of Errors of programming activity, and generalized into models that
are better able to suggest the causes of errors. For
Past classifications of errors identify a variety of types example, recent models of programming activity suggest
and causes of errors in many languages, environments, that programmers form a mental model of a program’s
and levels of expertise. Table 1 summarizes documented specifications [17]. This mental model may
classifications often cited in the literature chronologically. be insufficient because of a lack of domain or task
The summary is meant to be a representative sample of knowledge [9], an inadequate comprehension of the
past classifications, rather than an exhaustive list. specifications [5], or a poor description of a programs
There are many interesting patterns in the studies: requirements. This lack of knowledge can cause
failures due to errors can occur at compile-time and run- programmers to make a variety of errors. For example, a
time; a given error has many possible causes, including programmer may intentionally sort a list in increasing
lack of knowledge and forgetting; errors are made during order, forgetting that the specifications called for
specification, implementation, and debugging activities; decreasing order. Of course, creating and modifying
there are a variety of artifacts which are error prone. documented specifications may cause unforeseen
Many of these patterns were found in empirical studies problems, leading to errors as well.
5. Evaluation
To evaluate the utility of the model, we performed two
observational studies of programmers using the Alice 3D
event-based programming system [4]. Alice provides
objects (but does not support typical object-oriented
features such as inheritance and polymorphism), provides
explicit support for event-based constructs, and provides a
drag-and-drop, structured editing environment that
prevents syntax errors. A view of the Alice environment
can be seen in Figure 2. See www.alice.org for details. Figure 2. Alice v2.0: (1) objects in the world, (2) the 3D
worldview, (3) events, (4) details of the selected object,
and (5) the method being edited.
Experiment ID Hours Prog. Language Expertise Programming Tasks
Building B1 20 Ave. C++, Visual Parameterize rabbit hop animation; make tractor beam catch rabbit; programmatically animate camera moving
Virtual Basic, Java down stairs; prevent goat from penetrating ground after falling; play sound in parallel with character swinging bat.
Worlds B2 10 High C++, Java, Perl Randomly resize & move 20 handlebars using Jython, the Alice scripting language.
students B3 30 High C, Java Import, arrange, & programmatically animate objects involved in camera animation.
Pac-Man P1 5 High Java, C (1) Make Pac-Man move perpetually & change direction when player presses arrow keys; (2) make ghost move
participants P2 <1 Low C++, Java in random direction half the time & towards Pac-Man otherwise; (3) if chasing ghost eats Pac-Man, make Pac-
P3 10 High Java, C++ Man flatten & stop; (4) if Pac-Man eats big dot, make ghost run for 5 sec, then chase (5) if Pac-Man eats running
P4 <1 High Visual Basic ghost, make ghost stop for 5 sec & flatten (6) if Pac-Man eats all dots, make ghost stop & Pac-Man bounce.
Table 2. Total hours programmers spent programming the week of observation, self-rated language expertise, and tasks.
The majority of errors in these studies were (1) The model supports theoretical reasoning in a number
knowledge and attentional problems understanding of ways. First, it provides a vocabulary for reasoning
implementation artifacts and (2) attentional and strategic about programming errors and their causes, much like
problems implementing and modifying algorithms, Green’s Cognitive Dimensions of Notations [11] supports
language constructs, and uses of libraries. These errors reasoning about dimensions of programming languages.
forced programmers to spend nearly 50% of their time Like Green’s contribution, our model makes aspects of
debugging on average, and caused 29 knowledge and programming errors explicit. Future studies could identify
attentional breakdowns determining faults and errors, relationships between dimensions of notations and the
leading to further errors. This suggests that, at least in the causes of programming errors. For example, 24% of
tasks observed in this study, even a small number of breakdowns in our study were modification breakdowns.
debugging breakdowns lead to significant time costs. It This suggests that programming systems with structured-
also suggests a likely reason for the cost: because Alice editing environments that have high resistance to local
provides few facilities for inspecting the execution state changes (which Green would call “viscous”) may be
of programs, programmers were unable to attain particularly prone to modification breakdowns and errors.
knowledge about failures, which led to knowledge and Our model also supports reasoning about programming
attentional breakdowns in determining faults and errors, and debugging models. For example, von Mayrhauser and
leading to further errors. This data suggests that Alice Vans’ Integrated Comprehension Model [17] lacks any
needs better support for inspecting the state of execution mention of breakdowns in forming mental models of
and run-time interactions between program elements. specifications or code. Identifying areas where
Another interesting pattern was evident in comparing specification breakdowns can occur may help future
P3 and P4, who both finished the task, but had vastly studies of program comprehension explicitly link aspects
different strategies. For example, in creating a “while of the comprehension process to specific error types. Our
condition is true” event, P3 asked himself “How would I model could augment Blackwell’s Attention Investment
do this in Java?” while P4 asked the experimenter, “Just model of programming activity [2], describing how
to be clear, the ‘begin’ part of the while event only breakdowns and errors influence programmers’
executes once, right?” In these examples, P4 was perception of cost, risk, and investment. Our model also
obtaining knowledge about event concurrency, preventing supports models of debugging, such as Davies’ [9]. He
insufficient specification and implementation knowledge argues that programmers compare mental representations
breakdowns. Not only did P3 lack the knowledge to of the problem and program, but does not account for
prevent these breakdowns, but also his experience with breakdowns in knowledge formation or mismatch
Java caused interfering knowledge problems, leading to correction, which may affect debugging.
strategic breakdowns and errors. These observations show Our model also supports logical reasoning about the
that some strategies of acquiring knowledge about an errors within and between environments, languages, tasks,
unfamiliar programming system are error-prone, while and expertise. The studies reported in this paper are a
others are protective. small example of how the model is used to reason about
Although the analyses in this paper limit the errors within an environment, helping identify the most
conclusions we can draw, they demonstrate how our common breakdowns and error prone artifacts. Future
model of programming errors is helpful in forming studies can compare different programming systems’
hypotheses about errors programming systems and for abilities to prevent breakdowns, which would allow
designing better environments. Furthermore, the data we statements such as “language A is more prone to strategic
gathered in these observations is far from limited. Future problems reusing data structures than language B.”
analyses inspecting programmers’ specific errors will Finally, the model makes explicit what can prevent
reveal more specific design guidelines for more helpful breakdowns. Software engineering focuses on preventing
programming and debugging tools. Such analyses will unforeseen strategic problems in understanding, creating
also provide more insight into precisely what aspects of and modifying specifications. Programming systems
event-based programming make it difficult. focus on preventing implementation and debugging
breakdowns with support such as online documentation,
6. Discussion and colored syntax highlighting. Education focuses on
avoiding knowledge breakdowns. In fact, teaching this
We believe our model of programming errors supports model of errors to programmers might even prevent some
theoretical, educational and design research by helping to breakdowns, by strengthening knowledge and providing
describe, predict, and explain programming errors. foresight about programming and debugging strategies.
6.2 Supporting Design [3] M. Burnett, et al., "Forms/3: A First-Order Visual Language
to Explore the Boundaries of the Spreadsheet Paradigm,"
The model helps design programming systems by Journal of Functional Programming, 11, 2, pp. 155-206, 2001.
helping to identify the breakdowns that cause specific [4] M. Conway, et al., "Alice: Lessons Learned from Building a
errors. For example, from the small number of 3D System For Novices," at Proceedings of CHI 2000, The
observations presented in this paper, the authors learned Hague, The Netherlands, pp. 486-493, 2000.
two important lessons about Alice: (1) on average, [5] C. L. Corritore and S. Wiedenbeck, "Mental Representations
programmers spent 50% of their time debugging errors of Expert Procedural and Object-Oriented Programmers in a
that were caused by unforeseen strategic problems, and Software Maintenance Task," International Journal of Human-
Computer Studies, 50, pp. 61-83, 1999.
(2) debugging was aggravated by knowledge and
attentional breakdowns in determining faults. This [6] S. P. Davies, "Knowledge Restructuring and the Acquisition
suggests that a visualization of concurrent threads of of Programming Expertise," International Journal of Human-
Computer Studies, 40, pp. 703-726, 1994.
execution may prevent debugging breakdowns by
showing information that helps programmers better [7] M. Eisenberg and H. A. Peelle, "APL Learning Bugs," at
perceive and understand failures. APL Conference, pp., 1983.
Also, in reference to her difficulties in modifying a [8] M. Eisenstadt, "Tales of Debugging from the Front Lines," at
complex Boolean logic statement (the breakdown chain in Empirical Studies of Programmers, 5th Workshop, Palo Alto,
Figure 3), P2 remarked, “I’m really having trouble CA, pp. 86-112, 1993.
reading this…I think it’s right, but I can’t really tell…” [9] D. J. Gilmore, "Models of Debugging," Acta Psychologica,
This suggests that a more readable and less viscous pp. 151-173, 1992.
interface for creating logical statements may prevent [10] J. D. Gould, "Some Psychological Evidence on How People
perception and modification errors. Debug Computer Programs," International Journal of Man-
Using this model of programming errors to analyze Machine Studies, 7, pp. 151-182, 1975.
languages, environments and documentation standards [11] T. R. G. Green, "Cognitive Dimensions of Notations," in
could also suggest better design guidelines for tools and People and Computers V, A. Sutcliffe and L. Macaulay, Eds.
notations. For example, an analysis of errors in C++ Cambridge, UK: Cambridge University Press, 1989, 443-460.
would likely support the belief that operator overloading [12] T. R. G. Green, et al., "Parsing-gnisrap: A Model of Device
can cause attentional problems understanding language Use," at Empirical Studies of Programmers: 2nd Workshop, pp.,
1987.
constructs. An analysis of textual specifications would
likely reveal they cause unforeseen strategic problems [13] K. Holtzblatt and H. Beyer, Contextual Design: Defining
later in development, supporting the value of runtime Customer-Centered Systems. San Francisco, CA: Morgan
Kaufmann, 1998.
views in UML notation. Studying the use of print
statements, breakpoints, and watches might reveal that [14] W. L. Johnson, et al., "Bug Catalogue: I," Yale University,
these techniques are helpful in determining faults, but are Boston, MA, Technical Report 286, 1983.
prone to a variety of debugging breakdowns. [15] D. Knuth, "The Errors of TeX," Software: Practice and
Experience, 19, 7, pp. 607-685, 1989.
7. Conclusion [16] A. J. Ko and B. Uttl, "Individual Differences in Program
Comprehension Strategies in an Unfamiliar Programming
This paper presents a model of programming errors System," at International Workshop on Program
derived from past classifications of error types and studies Comprehension, Portland, OR, pp. (to appear), 2003.
of programming. We believe the model will be valuable [17] A. v. Mayrhauser and A. M. Vans, "Program Understanding
for future research on programming errors because it Behavior During Debugging of Large Scale Software," at
provides a common vocabulary for reasoning about Empirical Studies of Programmers, 7th Workshop, Alexandria,
VA, pp. 157-179, 1997.
programming errors, while supporting the description,
prediction, and explanation of programmers’ errors. [18] R. Panko, "What We Know About Spreadsheet Errors,"
Journal of End User Computing, pp. 302-312, 1998.
8. References [19] D. N. Perkins and F. Martin, "Fragile Knowledge and
Neglected Strategies in Novice Programmers," at Empirical
[1] J. R. Anderson and R. Jeffries, "Novice LISP Errors: Studies of Programmers, 1st Workshop, Washington, DC, pp.
Undetected Losses of Information from Working Memory," 213-229, 1986.
Human-Computer Interaction, 1, pp. 107-131, 1985. [20] J. Reason, Human Error. Cambridge, England: Cambridge
[2] A. Blackwell, "First Steps in Programming: A Rationale for University Press, 1990.
Attention Investment Models," at IEEE Symposia on Human- [21] I. Vessey, "Toward a Theory of Computer Program Bugs:
Centric Computing Languages and Environments, Arlington, An Empirical Test," International Journal of Man-Machine
VA, pp. 2-10, 2002. Studies, 30, pp. 23-46, 1989.