Applying Algorithm Animation Techniques for Program Tracing, Debugging, and Understanding
Total Page:16
File Type:pdf, Size:1020Kb
Applying Algorithm Animation Techniques for Program Tracing, Debugging, and Understanding Sougata Mukherjea, .John T. Stasko Graphics, Visualization and Usability Center, College of Computing Georgia Institute of Technology Atlanta, GA 30332-0280 Abstract “software visualization” is better because it is more general, encompassing visualizations of data struc- Algorithm antmation, which presents a dynamic vi- tures, algorithms, and specific programs. In fact, soft- sualization of an algorithm or program, primartly has ware visualization research primarily has concentrated been used as a teaching aid. The highly abstract, on two different subtopics: data structure display and application-specific nature of algorithm animation re- algorithm animation. quires human design of the animation views. We spec- Data structure display systems such as Incense[13], ulate that the application-specific nature of algorithm GDBX[3], and VIPS[l 1, 17] illustrate particular data animation views could be a valuable debugging aid for structures within a program, showing both the val- sofiware developers as well. Unfortunately, zf ani- ues and interconnections of particular data elements. mation development requires time -cons urntng des~gn These systems automatically generate a view of a with a graphics package, zt wdl not be used for de- data structure when the user issues a command to bugging, where timeliness is a necessity. We have de- do so. Other systems such as Pecan[16] provide ad- veloped a system called Lens that allows programmers ditional program state views of control flow, the run- to rapxdly (m mtnutes) butld algorithm animation - time stack, and so on. Data structure display systems styie program views wtthout requiring any sophisticated main application has been for debugging and software graphzcs knowledge or codtng. Lens is integrated with development. Commercial systems such as Borland a system debugger to promote iterative design and ex- C for PCS and CodeVision for SGI workstations even ploration. provide rudimentary data structure display capabili- ties within a software development environment. Algorithm animation, the second main subarea of 1 Introduction software visualization, provides views of the funda- People invariably have a difficult time understandi- mental operations of computer programs, concentrat- ng abstract concepts or processes. One way to im- ing more on abstractions of behavior than on a par- prove understanding is to provide specific examples, ticular program’s implementation[5]. The views pre- possibly using pictures to make an abstract concept sented are much more application-specific than the more concrete. The expression “Seeing is believing” generic views of data structure display systems. The relates that what we can visualize, we can grasp and movie Sorting out ,Sorting~2] motivated many of the understand. subsequent algorithm animation software systems that This notion can be applied to software under- have been developed, including Balsa[6], Animus[7], standing and the use of graphics and visualization Movie[4], and Tango [19]. In all these systems, a de- to depict computer algorithms and programs. Soft- veloper first designs a visual presentation for an al- ware visualization provides concrete representations gorithm, and then implements the visualization using to previously inanimate, abstract entities that have a support graphics platform. To date, the primary always been, and most likely always will be, rela- use of algorithm animations has been for teaching and tively difficult to understand. The use of graphics instruction. for illustrating software was originally called program Because algorithm animation views are complex msua~izatiun[l, 14, but more recently the term sofi- user-conceptualized depictions, they cannot be cre- ware visua/ization[15, 22] has been favored. The term ated automatically from a “black-box” program illus- 456 0270-5257/93 $03.00 @ 1993 IEEE trator. Rather, an animation designer crafts a par- of data structures, such as showing a clock face to rep- ticular view that is specifically tailored for a program. resent integer values hours and minutes. This design, Consequently, designing algorithm animations is time- however, requires writing the low-level graphics code intensive and usually restricted to already working to implement the view. programs. That is, a designer utilizes a fully func- The algorithm animation system Movie[4] focuses tional working program, designs a set of animation on rapid development of relatively straightforward al- routines for its visualization, and maps the program gorithm visualizations. The system provides a few to the corresponding routines. The resulting views simple commands which can be used to quickly de- can then be used as instructional aids for illustrating velop a visualization of a program in order to under- the program’s methodologies and behaviors. [Unfor- stand it better. Programmers still must learn the sys- tunately, the time and effort required to develop an- tem’s commands, however, and the system does not imations is considerable enough to limit their use to support smooth, continuous animation effects. pedagogy and preclude their use in software develop- The Gestural system[8] supports purely graphical ment and debugging. A programmer will not use a animation development on Smalltalk programs, but its tool for debugging whose development time outweighs only images are black rectangles and its only actions that to simply debug a program with traditional text- were movements following mouse-traced paths. based methods. The Dance system[20] allows developers to graph- This fact is unfortunate, however, because algo- ically build algorithm animations, then it generates rithm animations could offer key benefits to program the corresponding Tango[l 9] animation code to carry debugging and testing. The use of pictures to illus- out the specified actions. Unfortunately, programmers trate how programs work has always played an im- still must learn the underlying animation paradigm portant role in software engineering. Programmers, of Tango to develop views of algorithms or pro- in designing code, often implicitly construct a mental grams. Also, animation designs cannot be incremen- model of their program, how it should function, how it tally tested. The code must be generated, compiled, utilizes data, and so on. It is much easier for people to and run, but the design cannot be read back into the think in terms of these higher level abstractions (the system for modifications. big picture) than to try and comprehend how all of the The University of Washington Program individual operations and data work in c.onjunction— Illustrator[IO] truly requires no designer input to gen- particularly so for larger systems. Data structure dis- erate an algorithm animation. It analyzes program play systems, which have already been utilized in de- source code and produces its own abstract depiction. buggers, can only offer views of raw data; the notion The system was only developed to analyze sorting and of an overall picture does not exist there. Algorithm graph algorithms, however, using one particular style animations, conversely, offer views of a program’s ap- of view for each. Building an automatic “black-box” plication domain and semantics. These types of views algorithm animation style viewing tool for arbitrary can be critical for determining why a program is not programs appears to be an impossible task because performing in its desired manner. of the infinite number of different possible algorithms In particular, the use of animation is extremely and depictions. important because programs are fundamentally dy- Our work seeks to bridge the two domains of namic. Illustrating program data and states is use- data structure display and algorithm animation as ful for understanding, but illustrating how the pro- shown in Figure 1. We want a system that can pro- gram changes from state to state and evolves over vide application-specific animation views for debug- time is even more helpful. Consider developing a com- ging purposes. Unlike the UWPI system, we still want putational geometry program, a quicksort, a particle programmers to design their own animations. We do chamber simulation, or a graph colorability algorithm. not want to require the programmers to need to learn Would it not be extremely advantageous to have a dy- a graphics toolkit and write code using it, however. namic visualization of the program to watch during WJealso want our tool to work in conjunction with a program testing in order to see how it is working and debugger so that animation can be incrementally de- to help identify erroneous program actions? veloped without going through the edit-compile-run Particular systems have taken steps toward this cycle. merge of data structure display and algorithm anima- This work addresses the tail-end of the software de- tion. The data structure display system Incense[13] velopment pipeline, when a designer has already writ- allows developers to design their own abstract views ten portions of, or perhaps all of, a target program or 457 mastered. Raw data views Application-specilic generated user-defined To develop this kernel, we studied over 40 algorithm automatically y program views animations built with the XTango system[2 1]. The ‘Ihi.s work animations’ topics included sorting, searching, graph, n + * tree, string and graphics algorithms, as well as anima- tions of matrix multiplication, fft, hashing, producer- Data