Balloon Views of Source Code and Their Multiscalable Font Modes
Chun-Cheng Lin and Hsu-Chun Yen
Dept. of Electrical Engineering,
National Taiwan University
Outline
2
Common visualization of source code
3
With the visualization, programmers can show on the screen only the lines that they concern.
With the visualization, programmers can navigate, understand, and manipulate the classes and variables easily.
Fisheye view of source code (Furnas, 1986)
4
1 #include <iostream.h>
2 void main() {
3 int i, sum = 0;
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
6 }
7 cout << sum << endl;
8 }
#2
#1
#8
#3
#4
#6
#7
#5
#0
root (initial focus)
-1
-1
-1
-2
-2
-2
-2
-3
0
-dis(x,root)
(importance – distance)
1
3
3
2
0
2
2
1
2
dis(x,focus)
focus
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
show lines with value ≥ threshold
-2
-4
-4
-4
-2
-4
-4
-4
-2
threshold = -2
One can easily check the path from the focus to the root.
focus
focus
Fractal view of source code (Koike, 1995)
5
1 #include <iostream.h>
2 void main() {
3 int i, sum = 0;
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
6 }
7 cout << sum << endl;
8 }
#2
#1
#8
#3
#4
#6
#7
#5
#0
root (initial focus)
show lines with value ≥ threshold
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
By the fractal theory, the amount of lines that shows on the screen is kept constant.
focus
focus
rooted at the focus node
#2
#1
#8
#3
#4
#6
#7
#5
#0
1/2
1/16
1/16
1/8
1
1/8
1/8
1/2
1/8
threshold = 1/2
Multiscalable font mode of the fractal view of source code (Koike, 1995)
6
focus
By the mode, we can easily observe the views before and after changing focus.
Conventions of Tree Drawing
7
We concern!
Balloon Drawing of Rooted Trees
The balloon drawing of a rooted tree is a drawing having the following constraints:
8
Two models of balloon drawing (I)
( Koike & Yoshihara, 1993 )
9
120o
120o
120o
r1
r2
r3
Two models of balloon drawing (II)
– Bottom-up method ( Carriere & Kazman, 1995 )
10
inner circle
outer circle
R1
R2
R4
R3
θ1
r
Comparison
11
Balloon drawing under
the SNS model
Balloon drawing under
the fractal model
Clear display on large subtrees
Even include angles
Fisheye drawing�(Sarkar & Brown, CHI 1992 & CACM 1994)
12
Motivations
13
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
1 #include <iostream.h>
2 void main() {
3 int i, sum = 0;
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
6 }
7 cout << sum << endl;
8 }
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
Multiscalable font mode?
SNS view of source code
14
R1
R2
R4
R3
θ1
threshold = 2
show lines with value ≥ threshold
Multiscalable font mode
(font size reflects its value)
r
R
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
1 #include <iostream.h>
2 void main() {
3 int i, sum = 0;
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
6 }
7 cout << sum << endl;
8 }
rooted at the focus node
#2
#1
#8
#3
#4
#6
#7
#5
#0
3.59
1
1
1
5.05
1
1
1
2
The desirable properties in source code visualization
15
Target program
16
1. Multiscalable font mode of the fisheye view
17
(focusing on node 0)
(focusing on node 24)
2. Multiscalable font mode of the fractal view
18
(focusing on node 0)
(focusing on node 24)
3. Multiscalable font mode of the SNS view
19
(focusing on node 0)
(focusing on node 24)
Statistics
20
The SNS value of every line respects the number of its descendents
Multiple views of source code
21
A integrated program source code editor
Conclusion
22
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
1 #include <iostream.h>
2 void main() {
3 int i, sum = 0;
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
6 }
7 cout << sum << endl;
8 }
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
2 void main() {
4 for ( i = 1 ; I <= 10 ; i++ ) {
1 #include <iostream.h>
2 void main() {
3 int i, sum = 0;
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
6 }
7 cout << sum << endl;
8 }
1 #include <iostream.h>
2 void main() {
3 int i, sum = 0;
4 for ( i = 1 ; I <= 10 ; i++ ) {
5 sum += I;
6 }
7 cout << sum << endl;
8 }
Conclusion (cont)
23
Trace the path
Amount is fixed
reflect # of decendents