
Stacksplorer: Call Graph Navigation Helps Increasing Code Maintenance Efficiency Thorsten Karrery Jan-Peter Kramer¨ y Jonathan Diehly Bjorn¨ Hartmannz Jan Borchersy yRWTH Aachen University zComputer Science Division 52062 Aachen, Germany University of California fkarrer, kraemer, diehl, borchersg Berkeley, CA 94720 @cs.rwth-aachen.de [email protected] ABSTRACT We present Stacksplorer, a new tool to support source code navigation and comprehension. Stacksplorer computes the call graph of a given piece of code, visualizes relevant parts of it, and allows developers to interactively traverse it. This augments the traditional code editor by offering an additional layer of navigation. Stacksplorer is particularly useful to un- derstand and edit unknown source code because branches of the call graph can be explored and backtracked easily. Visu- alizing the callers of a method reduces the risk of introducing unintended side effects. In a quantitative study, programmers using Stacksplorer performed three of four software mainte- nance tasks significantly faster and with higher success rates, Figure 1: Stacksplorer visualizes and allows browsing and Stacksplorer received a System Usability Scale rating of the call graph of an application’s source code. For 85.4 from participants. the current focus method, it shows callers in the left column and methods called in the right. ACM Classification: H5.2 [Information interfaces and pre- sentation]: User Interfaces. - Graphical user interfaces. ing through the code [20]. Navigating source code includes General terms: Design, Human Factors file-based navigation, such as switching between classes that Keywords: Development Tools / Toolkits / Programming are usually implemented in separate files, and navigating the Environments, Visualization. semantics of the code, e.g., locating a variable definition or exploring the callers and callees of a certain method. Navi- INTRODUCTION gating the call graph has been shown to be particularly im- A large part of a software developer’s work is maintaining portant to understand code, to find out where to modify it, existing code bases. This includes adding new features, fix- and to assess the scope and side effects of any changes [13]. ing bugs, and refactoring code after the software has been We present Stacksplorer, a plug-in that modifies the user in- shipped. Maintenance has been shown to make up as much as 1 70% of the total expenses of a software project [19]. Because terface of the Xcode integrated development environment of this, analyzing and improving how programmers maintain (IDE) to visualize and navigate the neighborhood of any code has recently become an active area of research. given method in the call graph (Fig. 1). Stacksplorer lets de- velopers see and access the callers “upstream” of a method, Maintenance often comprises reading and understanding an reducing the risk of introducing unintended side effects. They unfamiliar piece of source code and identifying problem- can also navigate downstream to understand how operations atic sections. The developer then has to modify these sec- are implemented in an unknown piece of code. The call tions while being aware of potential side effects [15]. To do graph visualization helps developers retain the context of a this, the developer spends a large part of his time navigat- method and simplifies exploring and backtracking along in- teresting branches of the call graph. In a controlled experiment, developers solved code mainte- nance tasks using Xcode with and without Stacksplorer. Our results show that Stacksplorer helps developers to solve more tasks correctly in less time, with a heightened awareness of possible side effects. 1http://developer.apple.com/technologies/tools/xcode.html RELATED WORK may, after execution stopped, be queried “Why did this line’s Navigation Behavior color = blue”. Using a trace of the actual program execution, Today, most IDEs offer only limited tools for call graph re- the Whyline computes a dynamic slice, i.e., it determines lated code navigation. Moreover, these tools are often diffi- which method executions influenced the relevant property. cult to find and invoke. By observing programmers working Novice programmers using the Whyline could solve a bug with Eclipse on five change tasks in a 500SLOC2 Java appli- fixing task significantly faster than expert developers with- cation, Ko et al. [11] found that about a quarter of the devel- out the Whyline. Stacksplorer is, in contrast to the Whyline, opers’ time was spent navigating, either by following depen- not a debugging but a navigation tool; it does not allow users dencies or by searching for names. Between code segments to formulate an explicit question about a trace from a single related through structural relationships, users navigated us- execution but facilitates exploration of the call graph during ing scroll bars and the package browser (14% of the test code editing. period) or using the find and replace tool, although more suitable and effective tools are available in Eclipse (see also LaToza and Myers [14] scope searches in source code by re- [18]). To perform comparisons, developers navigated back stricting them to branches of the call graph originating in or and forth between code segments because by default, Eclipse leading to a certain method. The search results are visualized uses a single editing window. in a graph, revealing the paths leading from the starting point Lawrance and Burnett [16] presented PFIS (Programmer Flow of the search to each result. Unlike Stacksplorer, this visual- by Information Scent), a model based on information forag- ization is a feature of the search tool and not integrated with ing theory to predict a programmer’s navigation. In informa- the source code editor as a means for navigation. tion foraging theory, each link between two pieces of infor- mation has a certain scent that determines how likely a user Commercial IDEs such as Visual Studio, Eclipse, or Xcode will follow this link on her search for relevant information. offer various tools for exploring the call graph. Eclipse, for In PFIS, a link is defined as any navigation possible with example, is able to show multiple levels of callers and callees one click; scent is determined by comparing words used in of a method in a tree view; Visual Studio offers similar func- the source code with those used in a bug report, which ver- tionality. These tools can be used for navigation, but they do bally describes the users task. In an experiment, PFIS was not update automatically when the user navigates through the capable of predicting the navigation behavior of professional source code, and they are not part of, or visually connected software developers in a bug fixing task. to, the code editor. For navigation inside the source code ed- itor, most IDEs provide functionality to directly jump to the Recommender Systems definition of a method from where it is called, and some sup- Recommender systems for software development aim at de- port jumping to callers; these tools, however, lack a perma- termining automatically which information is relevant to the nent visualization that could provide additional information developer’s current task. Most systems first calculate a ‘de- scent and help the user stay oriented. gree of interest’ depending on the source file that is being edited, for all files in the project. They then recommend files with a degree of interest exceeding a threshold. Recom- Code Layout mender systems may take into account: a programmer’s nav- igation history [23]; the navigation history of all program- Other tools focus solely on laying out relevant source code mers in the same code [6]; the history of editing activities in elements visually in order to help developers navigating and addition to navigation [10]; and non-code resources such as keeping track of source code. DeLine et al. [5] use the graph- version control systems [24]. ically scaled down source code text file as an overview map for navigation. While being too small to be readable, it al- For small tasks, user studies of these tools consistently found lows discerning the structure of the source code, thus sup- that the total effort spent on navigating through a project porting inter- and intra-file navigation. could be reduced significantly, and that users considered au- tomated guidance in software projects helpful, especially In Code Bubbles [2], code is viewed and edited in bubbles, when they were new to the project. For more complex which can be arranged freely on a 2D plane. The bubbles projects, however, the effect recommender tools have may are connected with arrows representing existing relationships be minor compared to task and strategy specific effects [4]. between them. Users can use a number of tools, e.g., “Open In contrast to Stacksplorer, the recommender systems pre- Declaration”, to find exactly the bubbles they need. Code sented reduce the amount of information shown in the IDE, Bubbles is based on single methods as the basic navigational but they do not introduce new ways to visualize the structural unit, thus breaking the prevalent paradigm of regular IDEs, relationships that led to the recommendations. which are based on a class-file dualism. In a qualitative study, Call Graph Utilization programmers solved one of two maintenance tasks signifi- The Whyline [12] allows asking “Why did” or “Why didn’t” cantly faster with Code Bubbles than with Eclipse. The need questions about the textual and graphical output of an appli- for back-and-forth navigation was also reduced significantly. cation. For example, a line drawn in a painting application To combine the benefits of Code Bubbles and traditional IDEs, Stacksplorer offers the familiar file- (or class-)based 2source lines of code (number of non-comment, non-empty lines of source navigation extended by a method-based navigation along the code) call graph. of methods, there exists an edge from A to B if (and only if) Navigating variable access method B is called from the implementation of method A.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-