Using Spatial Memory to Navigate Source Code

Using Spatial Memory to Navigate Source Code

Code Thumbnails: Using Spatial Memory to Navigate Source Code Robert DeLine, Mary Czerwinski, Brian Meyers, Gina Venolia, Steven Drucker, and George Robertson Microsoft Research, Microsoft Corporation, Redmond, USA rdeline, marycz, brianme, ginav, sdrucker, ggr @ microsoft.com Abstract view requires knowing the name of the method, its containing class and the class‟s containing namespace; Modern development environments provide many to find an object using search requires knowing the features for navigating source code, yet recent studies name of the sought object or a nearby object. The num- show the developers still spend a tremendous amount of ber of symbols in even a modest program can over- time just navigating. Since existing navigation features whelm a developer‟s working memory, causing confu- rely heavily on memorizing symbol names, we present a sion and false navigation steps. A second problem is new design, called Code Thumbnails, intended to allow that source code‟s visual uniformity makes code diffi- a developer to navigate source code by forming a spa- cult to recognize at a glance, leading to disorientation. tial memory of it. To aid intra-file navigation, we add a (DeLine, Khella, Czerwinski and Robertson report an thumbnail image of the file to the scrollbar, which instance where a developer viewed a method, briefly makes any part of the file one click away. To aid inter- navigated away and returned without realizing it was the file navigation, we provide a desktop of file thumbnail same method as before.) Hence, a developer spends images, which make any part of any file one click away. considerable cognitive resources both on remembering We did a formative evaluation of the design with eleven symbols in order to navigate and on distinguishing one experienced developers and present the results. part of the code form another. To lower this cognitive burden, we introduce new 1. Introduction overview features to a development environment to better support the use of spatial memory to navigate Recent studies have shown that experienced developers source code. We call these new features Code Thumb- doing maintenance tasks on unfamiliar source code nails, shown in Figures 1 and 2. The rest of this paper spend a large fraction of their time simply navigating will describe Code Thumbnails (CT) and its preliminary around the code. In a modern development environ- evaluation. ment, such as Microsoft Visual Studio or Eclipse, a developer typically uses many features to navigate: 2. Code Thumbnails opening, switching between, and scrolling within tabbed documents; clicking on items in hierarchical overviews Our design introduces two user interface features to (class view, project file view); clicking on source code Microsoft Visual Studio: the Code Thumbnail Scrollbar entities (go to definition); and issuing textual queries or (CT Scrollbar, or CTS) for navigating within a file; and structural queries (find definition, find callers, find all the Code Thumbnail Desktop (CT Desktop, or CTD) for references) and jumping to the results. In a study of navigating between files. The CT Scrollbar, shown in experienced student developers modifying a 500-line Figure 1, supplements the document‟s vertical scrollbar Java program, Ko, Aung and Myers found that partici- with a thumbnail image of the entire document. The pants spent an average of 35% of their task time navi- document text is shrunk to fit the height of the scrollbar. gating [12]. In a similar study, in which experienced For short files, the thumbnail font size is capped at a professional developers modified a 3000-line C# pro- maximum of 2.5 points, keeping the text just below the gram, DeLine, Khella, Czerwinski and Robertson found threshold of readability; when this is the case (not that the inefficiencies of code navigation played a large shown in Figure 1), the unused portion of the display is role in participants‟ poor task completion rates [5]. In filled with gray. Our intention is that the developer can both studies, experienced programmers had difficulty use the text shape for visual landmarks (a perceptual navigating around programs of very modest size; the activity), without reading the text (a cognitive activity). problem is presumably worse in larger programs. The currently visible portion of the document is reflect- One reason why code navigation is so inefficient is ed both in the scrollbar’s “thumb” (as usual) and with a that most of the provided UI mechanisms are based on box drawn around the corresponding text in the thumb- memorizing symbol names. To open a file requires nail. Since Visual Studio provides a folding editor for knowing its name; to click on a method in a class over- code (that is, the text is parsed into a tree with collapsi- Figure 1. The Code Thumbnail Scrollbar adds a thumbnail image of the document to the scrollbar, with a rectangle indicating the current view (left). On mouse-over, it the names of potential navigation targets are revealed (right). ble nodes ), we reflect this tree in the code thumbnail editor is active is highlighted with a thicker border than with brackets representing the second- and third-level the others. Documents that are currently closed are nodes, which are typically types and their members. The shown with a grey background, grey title and no scroll brackets provide another form of visual landmark. area. As with the CT Scrollbar, moving the cursor over To navigate using the CT Scrollbar, a developer can a thumbnail pops up target labels, and clicking on a either use the scrollbar at left in the usual way, or she thumbnail activates the docum ent‟s editor and scrolls to can click on a location in the thumbnail to jump to the the chosen part of the document. C licking a thum bnail‟s corresponding place in the code. Whenever the mouse title area activates the docum ent‟s editor w ithout scrol- cursor is inside the thumbnail area, labels appear show- ling the document. Double-clicking a grayed thumbnail ing the names of likely navigation targets, specifically opens the document and activates its editor. the names of second-level items with no children (e.g., When the programmer uses any of the standard enums) and third-level items (fields and methods) as search tools, the search results are highlighted in both shown on the right side of Figure 1. In the current de- the CT Scrollbar and CT Desktop. This makes it easy to sign, these pop-up labels occlude the code shape, which see all search results at a glance. is an area for improvement. Both the CT Scrollbar and Desktop are intended to The CT Desktop, shown in Figure 2, shows a allow the developer to form spatial memory of the code. thumbnail image of every source file in the project, The CT Scrollbar provides a stable, one-dimensional arranged on a desktop surface. Each thumbnail has a space per document, with visual landmarks to help the label at the top, which shows the file name and serves as user distinguish different parts at a glance (namely, the a handle for moving the thumbnail. A developer can code shape, the brackets and the target labels). The CT arrange the thumbnails on the desktop as she sees fit. Desktop provides a stable, two-dimensional space of all The code thumbnails are drawn exactly like those in the the documents, again with visual landmarks (namely, CT Scrollbar, except that the currently visible portion is the thumbnail landmarks, plus their placement). drawn with a filled rectangle to make it more apparent. Our UI design choices were driven by our study We use the same font size for all thumbnails on the goals. Specifically, we were interested in whether de- desktop, w hich m eans that each thum bnail‟s height is velopers could form spatial memory of the code and proportional to its file‟s length . The document whose how that would affect their navigation choices. We Figure 2. The Code Thumbnail Desktop window shows thumbnail images of all source files, which the user arranges on a desktop surface. chose thumbnail images of the code to define the space that stationary or predictably moving cues are optimal, and provide visual landmarks because this depiction and that multiple sensory modalities can be combined to requires little learning from the user. In future studies, assist searching through an electronic space. They also we could weigh the spatial-memory benefits of Code have shown that if the space is not divided using a sim- Thumbnails against existing techniques or other, poten- ple, organizing principle, that users will impose their tially unfamiliar representations, like UML diagrams, own, conceptual organization upon the space. Voronoi Treemaps [1], or Software Terrain Maps [6]. However, in previous research, Jones and Dumais Our intention here is to do an initial evaluation of the [11] suggested that, for document retrieval, adding potential of the idea of Code Thumbnails. spatial information to the document has little value beyond giving the document a semantic label. In their 3. Spatial Memory and Visual Code Cues study, participants were able to accurately and efficient- ly retrieve stored documents in the real world with as There is a large body of literature on the use of spatial impoverished a semantic label as a two-letter cue! Stor- cognition while navigating graphical user interfaces (see ing the document in a spatial position did improve per- E hret‟s dissertation [8] for a recent example) and way- formance over baseline control conditions, however. finding [3][4][18], both for real and electronic spaces. Our goal is to build on research as to how land- Some of these studies have culminated in a set of guide- marks and spatial layouts generalize to the retrieval of lines for designers of virtual worlds [16].

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us