in Large Codebases for Program Comprehension. Vineet Sinha* ... ABSTRACT.
As software systems grow in size and use more third-party libraries and ...
Incremental Exploratory Visualization of Relationships in Large Codebases for Program Comprehension Vineet Sinha* Rob Miller David Karger
[email protected] [email protected] [email protected] MIT Computer Science and Artificial Intelligence Laboratory (CSAIL) 32 Vassar Street, Cambridge, MA 02139 which a user can browse the different types of relationships to incrementally add more code artifacts. Relo helps maintain context while users manage the visualization by choosing to remove or group artifacts together. Such visualizations, like concern graphs [5], represent only a small manageable part of the code and do not include irrelevant details allowing a user to focus on the important relationships.
ABSTRACT As software systems grow in size and use more third-party libraries and frameworks, the need for developers to understand unfamiliar large codebases is rapidly increasing. In this demonstration, we present a tool, Relo that supports users’ understanding by allowing interactive exploration of code. As the developer explores relationships found in the code, Relo builds and automatically manages a visualization mirroring the developer’s mental model, allowing them to group viewed artifacts or use the viewed items to ask the system for further exploration suggestions.
Relo visualizations try to be intuitive to end-users, showing code artifacts in diagrams similar to UML class diagrams, while at the same time allowing developers to zoom in to view and edit code using text editors embedded in the graph. Developers can therefore abstract to a high level, or zoom-in to see code. Relo further helps maintain users’ focus by providing explicit support for exploration while managing the amount and presentation of information to the user based on his/her interaction with code elements [1].
See also the related poster at OOPSLA [1]
Categories and Subject Descriptors D.2.2 [Design Tools and Techniques]: User interfaces; D.2.6 [Programming Environments]: Graphical environments, Interactive environments.
2. WALKTHROUGH Consider the scenario (as mentioned in [3]) of a user trying to understand a portion of the JHotDraw [7] project, which lets users draw a variety of figures including lines, triangles, rectangles, etc. Let us trace through the steps of a developer trying to understand how to operate on figures. The developer starts by examining a package called figure that seems related to the task and is one of the small number of packages in the project. The developer continues by opening the class EllipseFigure in Relo.
General Terms Management, Design, Human Factors.
Keywords Program Comprehension, Software Visualization, Large Software Systems.
1. INTRODUCTION Working with the complexity of large software projects is a pervasive and growing problem. Developers face increasing difficulties in comprehending and maintaining a mental model of the code in large codebases. While techniques like object-oriented programming and design patterns have helped control complexity by allowing developers to create and use appropriate abstractions and encapsulate inessential details, these techniques require a developer reading the code to follow many kinds of relationships at once. For example, following a function call, once a simple task, now also requires keeping track of inheritance and polymorphism.
Figure 1: Relo started by opening EllipseFigure
Figure 2: After adding the method basicMoveBy
We present a program comprehension tool called Relo, which helps developers to understand the roles of the multiple types of relationships in a software system. Relo visualizations start with a single code artifact (such as a package, class, or method), from _________________________________ * This work has been supported by the MIT Oxygen Project
Figure 3: Clicking on the class to show the handles on it On starting Relo with EllipseFigure the user is presented with Figure 1. The figure shows that the class has 15 members, and the
Copyright is held by the author/owner(s). OOPSLA’05, October 16–20, 2005, San Diego, California, USA. ACM 1-59593-193-7/05/0010.
198
another class (shown in Figure 3). At a glance the user knows that the no other classes inherit from it, and notices that he is provided with handles for expanding, shrinking, or removing the class. The user continues his exploration by clicking upwards through the superclasses (Figure 4).
user clicks on the menu to see a list. Considering the method ‘basicMoveBy’ as potentially interesting, he clicks on the method name in the menu and thereby adds the method to the diagram (Figure 2). Once added the user clicks on the class and is presented with a vertical handle indicating the class inherits from
At this point in time the user has an idea of the inheritance tree of figures in the project, and he can choose to expand the topmost class with an implementation. After double-clicking to see all public methods and remove irrelevant methods, the user decided to expand the addFigureChangeListener method, as it seems to be part of the general framework for changing figures. The user is presented with the Figure 5, which shows the implementation of the method. A simple option will be to collapse the class AbstractFigure and to examine a caller of addFigureChangeListener. On clicking the caller handle on the base class, Relo continues to build the graph (shown in Figure 6), and has begun to act as both a call-hierarchy browser and an inheritance-hierarchy browser. Unlike previous graphical [6] or tree widget approaches used in most IDE’s, all the relationships are being shown by Relo in one place instead of having separate views for each relationship. Additionally, the diagram only shows the queried-for code elements and does not need to make visible all the other classes in the shown packages, as would be done by tools only supporting expansion via visual containment [2]. Finally, the diagram shows some unexpected relationships, such as some calling methods belong to the same class, an observation that would not have been possible by showing the relationships and code elements in a single tree widget as done by [3].
Figure 4: Clicking on the inheritance handles
The user can further continue using Relo, as the tool goes on to build a larger visualization in order to supplement the user’s understanding of the codebase.
3. IMPLEMENTATION Relo is built as an integrated plug-in into the Eclipse environment, and is freely available from: http://relo.csail.mit.edu
REFERENCES
Figure 5: Expanding the class AbstractFigure and the method addFigureChangeListener
Figure 6: Asking for callers of addFigureChangeListener
199
[1]
Sinha, V., Miller, R., Karger, D. R. " Incremental Exploratory Visualization of Relationships in Large Codebases for Program Comprehension”, Poster, OOPSLA 2005.
[2]
Storey, M.-A., Muller, M., and Wong, K. "Manipulating and documenting software structures using SHriMP views”, ICSM 1995.
[3]
Janzen, D., and Volder, K. D. “Navigating and Querying Code Without Getting Lost”, AOSD 2003.
[4]
Teevan, J., Alvarado, C., Ackerman, M. S., and Karger, D. R. “The perfect search engine is not enough: a study of orienteering behavior in directed search”. CHI 2004.
[5]
Martin P. Robillard , Gail C. Murphy, “Concern graphs: finding and describing concerns using structural program dependencies”, ICSE 2002.
[6]
Reiss, S. “Visualization for Software Engineering – Programming Environments”, Chapter 18, pages 259-276, in “Software Visualization”, ed. Stasko et al.
[7]
JHotDraw. http://www.jhotdraw.org/