Using Sex Differences to Link Spatial Cognition and Program Comprehension Maryanne Fisher Department of Psychology Saint Mary’s University Halifax, Nova Scotia, Canada mlfisher@smu.ca Anthony Cox Faculty of Computer Science Dalhousie University Halifax, Nova Scotia, Canada amcox@cs.dal.ca Lin Zhao Faculty of Computer Science Dalhousie University Halifax, Nova Scotia, Canada lzhao@cs.dal.ca Abstract Spatial cognition and program development have both been examined using contrasting models. We suggest that sex-based differences in one’s perception of risk is the key to relating these models. Specifically, the survey map approach to navigation and the top-down develop- ment/comprehension strategy use similar and related high risk cognitive skills that males show a preference towards. Conversely, the route-based approach to navigation and the bottom-up development/comprehension strategy use simi- lar and related low risk cognitive skills that women show a preference towards. On the assumption that programmers are consistent in their risk-taking behaviours, we believe that they will, as much as possible, tend to use the same strategy when performing program development and com- prehension. In an experimental setting, we compare pro- grammer’s performance on spatial cognition and program comprehension tasks. The correlations that we found sug- gest that programmers use equivalently risky strategies for program comprehension and spatial cognition. Thus, there is evidence that similar cognitive skills are used for spatial cognition and program comprehension/development, and that the similarities are a consequence of sex-based differ- ences in risk-taking behaviour. 1 Introduction Program comprehension, reading a map, and driving an automobile are tasks that, at first, appear to have little in common. However, it is very unlikely that we have devel- oped a highly specialised skill set for each of these tasks. Instead, as a result of evolutionary pressures, we have devel- oped a small set of widely adaptable, general purpose cogni- tive skills and structures [5]. When given a new activity that requires a cognitively complex skill set, the needed skills are generated by adapting and combining existing skills [4]. Furthermore, mechanisms and structures that have proved useful in one domain will be used in similar domains and will be changed only when driven by the need for perfor- mance improvement [4]. As the need for program comprehension skills has de- veloped only recently, in evolutionary terms, these skills must result from the ‘new’ application of existing skills. We postulate that some of the skills used during program com- prehension overlap significantly with those used for spa- tial cognition. In other words, we equate the navigation and exploration of source code, an abstract virtual space, with our navigation of the world in which we live, a three- dimensional physical space. A rationale for equating the application of real-world navigation skills with those used in virtual spaces has been suggested by Vinson [35]. In previous research [7], we used the term codespace to describe the abstract mental representation that program- mers form for a software system. We now further refine this definition and define codespace as: A programmer’s mental model of source code with respect to the perceived spatial attributes of entities identified within the code. We focus on source code, as opposed to other representa- tions (e.g., flow graphs, class hierarchy diagrams), as these alternative representations can be considered as abstractions of the source code. We also consider other code-like arti- facts (e.g., build scripts) as part of a system’s source code. Support for this definition is provided by Green [13], who postulates that “mental representations of programs seem to use spatial imagery where possible.” Evidence also suggests that, when possible, programmers use spatial im- agery as a coding for program concepts [14]. Green and Navarro found that program comprehension was facilitated when related program concepts occurred in close physical proximity [14]. Douce et al. [11] suggest that comprehen- sion and maintenance substantially use programmer’s spa- tial abilities and that the source file can be viewed as pro- gram space. Movement by a programmer, within and between the 22nd IEEE International Conference on Software Maintenance (ICSM'06) 0-7695-2354-4/06 $20.00 © 2006