Software Visualization
Information Visualization June 30, 2008
Carsten Görg
Slides adapted from John Stasko
Summer term 2008 2
Housekeeping
• Assignment 5: Understanding Analytics
due this Wednesday, July 2nd • Poster Grading
• Remaining lectures:
− Animation + tips for exam (Wednesday)
− Visual Analytics (Monday)
− Final Exam (Wednesday)
− Wrap up (Monday)
Summer term 2008 3
“The use of the crafts of typography, graphic design, animation, and cinematography with modern human-computer interaction and human-computer graphics technology to facilitate both the human understanding and effective use of computer software.”
Price, Baecker and Small, ‘98
Software Visualization
• Definition
Summer term 2008 4
Summer term 2008 5
Challenge
• Software clearly is abstract data
• Unlike much information visualization, however, software is often dynamic, thus requiring our visualizations reflect the time dimension − History views − Animation − ... Summer term 2008 6
Subdomains
• Two main subareas of software visualization
− Program visualization - Use of visualization to help programmers, coders, developers.
Software engineering focus
− Algorithm visualization - Use of visualization to help teach algorithms and data structures. Pedagogy focus
Summer term 2008 7
Subareas
• Program Visualization − Software engineering − Debugging − Program analysis − Systems/Architectures − Evolution • Algorithm Visualization − Pedagogy − Systems − Use in classroom − Empirical study Summer term 2008 8Lecture Focus
• This is a very big area, so this lecture will just give a flavor of the kinds of
techniques and systems that have been created
− Lots of figures
Summer term 2008 9
ACM SoftVis
’03 – San Diego ’05 – St. Louis ’06 – Brighton ’08 – Germany Summer term 2008 10Algorithm Visualization
• Learning about algorithms is one of the most difficult things for computer science students
− Very abstract, complex, difficult to grasp
• Idea: Can we make the data and
operations of algorithms more concrete to help people understand them?
Summer term 2008 11
Algorithm Animation
• Common name for area
• Dynamic visualizations of the operations and data of computer algorithm as it executes
− Abstraction is key concept
Summer term 2008 12
Sorting Out Sorting
• Seminal work in area
• 30 minute video produced by Ron Baecker at Toronto in 1981
• Illustrates and compares nine sorting algorithms as they run on different data sets
Summer term 2008 13
SoS Views
Video
Summer term 2008 14
Balsa
• First main system in area
• Used in “electronic classroom” at Brown
• Introduced use of multiple views and interesting event model
M. Brown Computer ‘88
Summer term 2008 15
Example Animation
Summer term 2008 16
Tango
• Added smooth animation to algorithm animation
• Simplification of the design/programming process (easier programming model and framework)
• Formal model of the animation, the Path-Transition Paradigm
Stasko Computer ‘90
Summer term 2008 17 Multiple frames from bubblesort
Tango
Summer term 2008 18POLKA
• Improved animation design model
• Object-oriented paradigm
• Multiple animation windows
• Much richer visualization/animation capabilities
Stasko & Kraemer JPDC ‘93
Summer term 2008 19
POLKA
Demo
Summer term 2008 20
Evaluating Effectiveness
• Do algorithm animations actually help students learn?
− That’s the claim, but unproven
• Conducted a number of empirical studies to answer question
− Compare learning with animation to learning without
Summer term 2008 21
Results
• Somewhat mixed, but some studies do show benefits
− -> Potential for pedagogical aid is there, but just can’t throw animation at algorithm and expect it to help
− Interaction is a key
Blindly watching algorithm animation not really helpful Student must interact with animation and be engaged
− Animations help motivation, can make algorithm less intimidating
Hundhausen, Douglas & Stasko JVLC ‘02
Summer term 2008 22
Program Visualization
• Can be as simple as enhanced views of program source
• Can be as complex as views of the
execution of a highly parallel program, its data structures, run-time heap, etc.
Summer term 2008 23
Enhanced Code Views
Primarily used as a documentation aid
Summer term 2008 24
SeeSoft System
• Pulled-back, far away view of source code
• Map one line of source to one line of pixels
− Can indicate line indentation, etc.
• Like taping your source code to the wall, walking far away, then looking back at it
Eick, Steffen and Sumner IEEE ToSE ‘92
Summer term 2008 25
System View
15,000 lines of code in 52 files Summer term 2008 26Use
• Tracking (typically means mapping this data attribute to color)
− Code modification (when, by whom)
− Bug fixes
− Code coverage or hotspots
• Interactive, can change color mappings, can brush views, and so on
Summer term 2008 27
Tarantula
• System developed at GT
• Utilizes SeeSoft code view methodology
• Takes results of test suite run and helps developer find program faults
• Clever color mapping is the key
Eagan, Harrold, Jones & Stasko InfoVis ’01
Jones, Harrold & Stasko ICSE ‘02
Summer term 2008 28
Tarantula View
Video
Summer term 2008 29
Paper Recap
“CVSscan: Visualization of Code Evolution” Lucian Voinea, Alex Telea, Jarke J. van Wijk
SoftVis’05: Proceedings of the 2005 ACM Symposium on Software Visualization
Stefan Heinz
Summer term 2008 30
Motivation
• Program and process understanding is an important aspect of software maintenance
• Most visualizations focus on high-level system abstractions or they don't consider the entire project duration
• Typical questions the tool helps to answer:
− What lines were added, removed, altered and when?
− Who performed this modifications?
Summer term 2008 31
Technique
• Data set consists of tuples <id, author, date, code> • Usage of line-oriented displays
• Basic layout / color scheme:
Summer term 2008 32
Technique/Application
interval selector code view, second layer code view, main layerversion centric filter
attribute selection view mode
Summer term 2008 33
Case Studies
• Record and analyze the experiences of maintainers investigating completely new programs
− Analysis of a Perl script file (457 glp, 65 versions)
− Analysis of a C code file (2900 glp, 60 versions) • Results:
− Supports quick assessment of the important activites and produced artifacts
Summer term 2008 34
Critique (Pros & Cons)
• Shows the whole file evolution at once • Different coloring schemes• Details are shown by the code view and the second layer supports a smooth file browsing • No visualization of project evolution or context
of a file in the project
• Two points of focus when browsing in the file (at least when used mouse-only)
Summer term 2008 35
Stepping Up
• Next step in program visualization is to help debugging and performance
optimization by visualizing program executions
− Data, data structures, run-time heap,
memory, control flow, data flow, hot spots, ...
Summer term 2008 36
Graph Visualization
• Area that we’ve already studied which is very important to SV
• Graphs pop up everywhere in software
• Common use: Visualize a call graph, visualize a flow chart, ...
Summer term 2008 37
Sample CallGraph View
Summer term 2008 38
Paper Recap
“Visualizing Java in Action”
Steven P. Reiss
Proc. IEEE Conference on Software Visualization, Mai 2003
Summer term 2008 39
Motivation
• Dynamic software visualization aims to provide insights into a running system
• Most current dynamic visualizations based on traces or slow down program substantially
ÆNo real time information • JIVE
− Java visualization framework
− Minimal overhead
ÆSlowdown by factor 2 or less
− Emphasis on real time
− Informative & entertaining
Summer term 2008 40
Information
• High-level program-specific information
− Executing classes
Number of method calls Execution time per class − Memory
Classes of allocated objects Memory consumption per class − Thread behavior
Thread state monitoring Synchronization and blocking
• Internal Java hooks too slow ÆPatching of target classes ÆAggregation for libraries
Summer term 2008 41
Technique
• Compact & scalable display
• Needs to show large number of objects • Box display
− Simple
− Fast & easy to understand • One box per class
− Height: # method calls
− Width: # allocated objects by this class
− Hue: # allocated objects of this class
− Intensity: Usage within time interval • Stacked boxes per thread
− Height: % time in thread state
− Hue: Thread state
Summer term 2008 42
Summer term 2008 43
Critique
+ Real time information with minimal overhead + Simple & compact display
+ Easy to use & fun to watch
- Patching time
- Artifacts caused by tracing code itself - Limited control over visualization
Summer term 2008 44
Paper Recap
“Visualization of Program-Execution Data for Deployed Software”
Alessandro Orso, James Jones, Mary Jean Harold Proc. of SoftVis '03, May 2003, pp. 67-76
!
"#$%%$&%' () *$& *$(+,,+ -.&/0/) 01$02( ( &//3 /( / (
*
!! ""
'/0( 04"$/ 3( 504//$ /15(2( 0461/2 / /15(2 03( /12 /7( 80 15(*2(# $%
'4 12 12(/ /( 7/4 132( /01'7/2/; ( 4'/ ; 3/ ( 7/0( '4'/ (7/;(<
5*:."&&"6--" << ( + $ ( $9( = > %"7" ( & ' ( $ )% * 5 /)&( #00 $ //$ ( =0/1:3$ : $ :2( 53:" ; ( # =///0/ 3/( "/33;Summer term 2008 45
Paper Recap
“Program Comprehension through Software Habitability” Richard Wettel and Michele Lanza
Faculty of Informatics - University of Lugano, Switzerland Daniel Lorig
Summer term 2008 46
Motivation
• Widely used program comprehension is visualization • Many of the proposed visualizations fail at transmitting a sense of „habitability“ to the viewer
• in 2D visualizations, the viewer looks at a system like a picture, without notion of physical space
• 3D visualizations fail to produce a notion of locality because objects can be freely moved
→ Proposed 3D visualization supports habitability and locality
Summer term 2008 47
The City Metaphor
• Display classes (and interfaces) as buildings in city districts (representing packages)
• height represents NOM, width and length represent NOA
Summer term 2008 48
Refinement
• humans not good at distinguishing so many distinct shapes • map to a discrete number of shapes
Summer term 2008 49
Application
change impact of an interface exploring a „suburb“
Summer term 2008 50
Critique (Pros & Cons)
+ habitability and locality through navigable and interactive environment+ developers can talk about certain parts of the city as as actual physical place Æeases communication between people
- allows no exploration of concrete classes via the city metaphor (shows only the source code)
-relationships like inheritance and method invocations are not represented
Summer term 2008 51
Commercial Systems
• A number of commercial program
development environments have begun to incorporate program visualization tools such as these
− Majority are PC-based
• Has not become as wide-spread as I would have anticipated
Summer term 2008 52
Summer term 2008 53
Concurrent Programs
• Understanding parallel programs is even more difficult than serial
• Visualization and animation seem naturals for illustrating concurrency
• Temporal mapping of program execution to animation becomes critical
Kraemer & Stasko JPDC ‘93
Summer term 2008 54
POLKA
• We developed a system, POLKA, that was designed to help people build
visualizations of concurrent programs − Used for both program and algorithm
visualization
− Used for different programming models: message passing, shared memory threads, ...
Stasko & Kraemer JPDC ‘93
Summer term 2008 55
Message Passing Systems
PVM/Conch
Topol, Stasko, Sunderam IJPDSN ‘98
Summer term 2008 56
Shared Memory Threads
Zhao & Stasko TR ‘95 Pthreads
Summer term 2008 57
Current State of SV
• Research continues…
• Some use of algorithm animations as pedagogical aids
• Program visualization trickling into commercial tools
Summer term 2008 58
What’s Needed? (PV)
• Better analysis of what software developers want and need
• Flexible displays providing overview and detail
• Improved tracing/monitoring/analysis capabilities
Summer term 2008 59
What’s Needed? (AA)
• Focus on interactive tools
• Simpler animation construction
• Empirical validation of value
Summer term 2008 60
References
• All referred to papers