Visualization of Exception Handling Constructs to Support...
Transcript of Visualization of Exception Handling Constructs to Support...
Hina Shah
Visualization of Exception Handling Constructs to Support Program
Understanding
Carsten Görg and Mary Jean Harrold
Supported by NSF under CCR-0205422, CCF-0429117, CCF-0541049,and CCF-0725202, and Tata Consultancy Services, Ltd.
Presenter supported by SIGSOFT CAPS(patents pending)
• focus on improving analysis techniques
• provide no visualrepresentation
• focus on low-level abstraction
• provide no system-wide view• provide no context
Analysessimplify exception structure [Robillard and Murphy 2000]
identify exception flow [Sinha et al. 2004]
identify re-thrown exception chains [Fu and Ryder 2007]
VisualizationsExPo : throw-catch pairs as flow graph. [Sinha et al. 2004]
EXTEST : exception propagation and navigation path as tree [Fu, Ryder 2005]
ExceptionBrowser : exception propagation as tree [Chang et al. 2002]
Existing Techniques
• focus on improving analysis techniques
• provide no visualrepresentation
• focus on low-level abstraction
• provide no system-wide view• provide no context
Analysessimplify exception structure [Robillard and Murphy 2000]
identify exception flow [Sinha et al. 2004]
identify re-thrown exception chains [Fu and Ryder 2007]
VisualizationsExPo : throw-catch pairs as flow graph. [Sinha et al. 2004]
EXTEST : exception propagation and navigation path as tree [Fu, Ryder 2005]
ExceptionBrowser : exception propagation as tree [Chang et al. 2002]
Existing TechniquesGoal
Create Visualization that provides• different perspectives for viewing
exception-handling information• at different levels of detail• along with context
GoalCreate Visualization that provides
• different perspectives for viewing exception-handling information
• at different levels of detail• along with context information
GoalCreate Visualization that provides
• different perspectives for viewing exception-handling information
• at different levels of detail• along with context information
ResultVisualization with three views
• shows static-analysis information of exception-handling constructs
• at different levels of detail • along with context
Exception handling in JavaSurveyVisualizationEvaluationConclusion
Outline
Survey ConclusionException Ha.. Visualization Evaluation
Outline
Exception handling in JavaSurveyVisualizationEvaluationConclusion
Survey ConclusionException Ha.. Visualization Evaluation
Exception Handling constructsexception typestry blocks throw statementscatch blocksfinally blocks
Exception Handling in Java
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
Survey ConclusionException Ha.. Visualization Evaluation
Exception Handling in Java
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
Exception Handling constructsexception typestry blocks throw statementscatch blocksfinally blocks
Survey ConclusionException Ha.. Visualization Evaluation
Exception Handling in Java
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
Exception Handling constructsexception typestry blocks throw statementscatch blocksfinally blocks
Survey ConclusionException Ha.. Visualization Evaluation
Exception Handling in Java
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
Exception Handling constructsexception typestry blocks throw statementscatch blocksfinally blocks
Survey ConclusionException Ha.. Visualization Evaluation
Exception Handling in Java
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
Exception Handling constructsexception typestry blocks throw statementscatch blocksfinally blocks
Survey ConclusionException Ha.. Visualization Evaluation
Exception Handling in Java
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
Exception Handling constructsexception types try blocks throw statementscatch blocksfinally blocks
Survey ConclusionException Ha.. Visualization Evaluation
Goalunderstand the needs of developers inform the design of our visualization system
Survey
Processcreated initial questionnaire designconducted pilot runs revised questionnaire based on feedbackconducted the actual survey
demographics (34 participants)exception-related questions
Survey ConclusionException Ha.. Visualization Evaluation
Demographics (34 Participants)
171
513
66
46
127
199
Software DeveloperProject Manager
Test EngineerStudent
< 1 yr1-2 yrs2-3 yrs4-5 yrs> 5 yrs
small (> 5 KLOC)medium (5-50 KLOC)
large (> 50 KLOC)
Cur
rent
R
ole
Pro
fess
iona
l E
xper
ienc
e
Pro
ject
S
ize
Number of Participants
Survey ConclusionException Ha.. Visualization Evaluation
Demographics (34 Participants)
171
513
66
46
127
199
Software DeveloperProject Manager
Test EngineerStudent
< 1 yr1-2 yrs2-3 yrs4-5 yrs> 5 yrs
small (> 5 KLOC)medium (5-50 KLOC)
large (> 50 KLOC)
Cur
rent
R
ole
Pro
fess
iona
l E
xper
ienc
e
Pro
ject
S
ize
Number of Participants
Survey ConclusionException Ha.. Visualization Evaluation
Demographics (34 Participants)
171
513
66
46
127
199
Software DeveloperProject Manager
Test EngineerStudent
< 1 yr1-2 yrs2-3 yrs4-5 yrs> 5 yrs
small (> 5 KLOC)medium (5-50 KLOC)
large (> 50 KLOC)
Cur
rent
R
ole
Pro
fess
iona
l E
xper
ienc
e
Pro
ject
S
ize
Number of Participants
Survey ConclusionException Ha.. Visualization Evaluation
Demographics (34 Participants)
171
513
66
46
127
199
Software DeveloperProject Manager
Test EngineerStudent
< 1 yr1-2 yrs2-3 yrs4-5 yrs> 5 yrs
small (> 5 KLOC)medium (5-50 KLOC)
large (> 50 KLOC)
Cur
rent
R
ole
Pro
fess
iona
l E
xper
ienc
e
Pro
ject
S
ize
Number of Participants
Survey ConclusionException Ha.. Visualization Evaluation
Exception-Related QuestionsNumber of Participants 0 5 10 15 20 25 30
Is 'number of throw-catch pairs' useful?
Is 'exception concentration/distribution' information useful?
Is 'exception-dependency information' useful?
Is 'number of exceptions of a type information' useful?
Is visually representing 'where exception originated' useful?
Is visually representing 'where exception caught' useful?
Is visually representing 'what type of exception occurred'useful?
Is visually representing 'complete exception flow' useful?
Yes No Maybe
Number of Participants
Survey ConclusionException Ha.. Visualization Evaluation
0 5 10 15 20 25 30
Is 'number of throw-catch pairs' useful?
Is 'exception concentration/distribution' information useful?
Is 'exception-dependency information' useful?
Is 'number of exceptions of a type information' useful?
Is visually representing 'where exception originated' useful?
Is visually representing 'where exception caught' useful?
Is visually representing 'what type of exception occurred'useful?
Is visually representing 'complete exception flow' useful?
Yes No Maybe
Exception-Related QuestionsNumber of Participants
Qua
ntita
tive
Survey ConclusionException Ha.. Visualization Evaluation
0 5 10 15 20 25 30
Is 'number of throw-catch pairs' useful?
Is 'exception concentration/distribution' information useful?
Is 'exception-dependency information' useful?
Is 'number of exceptions of a type information' useful?
Is visually representing 'where exception originated' useful?
Is visually representing 'where exception caught' useful?
Is visually representing 'what type of exception occurred'useful?
Is visually representing 'complete exception flow' useful?
Yes No Maybe
Exception-Related QuestionsNumber of Participants
Con
text
ual
Qua
ntita
tive
Survey ConclusionException Ha.. Visualization Evaluation
0 5 10 15 20 25 30
Is 'number of throw-catch pairs' useful?
Is 'exception concentration/distribution' information useful?
Is 'exception-dependency information' useful?
Is 'number of exceptions of a type information' useful?
Is visually representing 'where exception originated' useful?
Is visually representing 'where exception caught' useful?
Is visually representing 'what type of exception occurred'useful?
Is visually representing 'complete exception flow' useful?
Yes No Maybe
Exception-Related QuestionsNumber of Participants
Con
text
ual
Qua
ntita
tive
Survey ConclusionException Ha.. Visualization Evaluation
Quantitative View
Flow View
Contextual View
Visualization
FlowContextual Quantitative
Examples• which type of exception reaches which throw statement
• which throw statement reaches which catch block
Survey ConclusionException Ha.. Visualization Evaluation
Visualization
Packages
Classes
Methods
Exception-handling constructs
NanoXML2700 LOC 3 packages 5 classes85 methods
(Downloaded from: http://nanoxml.sourceforge.net/original)
ExampleColor Scheme
Survey ConclusionException Ha.. Visualization Evaluation
Quantitative View
Package 3
Package 2
Package 1
Package 1 Package 2 Package 3
1 2-5 6-10 11-15 15-20
throw
catch
catchthrow
ThrowC
atch
Survey ConclusionException Ha.. Visualization Evaluation
Quantitative View
Package 3
Package 2
Package 1
Package 1 Package 2 Package 3
1 2-5 6-10 11-15 15-20
Class 3
Class 2
Class 1
Class 1 Class 2 Class 3
1 2-5 6-10 11-15 15-20
Method 3
Method 2
Method 1
Method 1 Method 2 Method 3
1 2-5 6-10 11-15 15-20
Survey ConclusionException Ha.. Visualization Evaluation
Quantitative View - NanoXML
1 2-5 6-10 11-15 15-20
Survey ConclusionException Ha.. Visualization Evaluation
Flow ViewMyException e = new MyException();….….….try{….if(faultyCondition==true)throw e;….….….….
} catch(MyException ex){// recovery code}
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
Survey ConclusionException Ha.. Visualization Evaluation
Flow ViewMyException e = new MyException();….….….try{….if(faultyCondition==true)throw e;….….….….
} catch(MyException ex){// recovery code}
method(){MyException e = new MyException();
try{…if(flag==null){
throw e;}else{// normal execution
}}catch(MyException e){// recovery code
}finally{// clean up code
}}
type definition
Throw statement
Catch statement
Survey ConclusionException Ha.. Visualization Evaluation
Flow View - NanoXMLXMLParseExceptiontype
throw
catchEXIT
Survey ConclusionException Ha.. Visualization Evaluation
Contextual ViewPackageMethod Class
Survey ConclusionException Ha.. Visualization Evaluation
Contextual View - NanoXML
skipBogusTag () parse ()
Survey ConclusionException Ha.. Visualization Evaluation
Three Visualizations
Program analysis tool
X
Survey ConclusionException Ha.. Visualization Evaluation
Exception Handling Centric (EnHanCe)
Visualization
Eclipse
eptools[Sinha et al.
2000]
Program analysis tool
X
Program analysis tool
Y
Program Analysistool
EnHanCe Visualization
Survey ConclusionException Ha.. Visualization Evaluation
EnHanCe Screenshot
Survey ConclusionException Ha.. Visualization Evaluation
GoalsUnderstand
current approach- how developers deal with exception-handling constructs visualization usefulness - whether visualization will help better understand exception-handling
Evaluation
Processcreated interview guideconducted pilot study with three participants (1-4 years experience)conducted detailed study with eight participants (1-10 years experience)
Survey ConclusionException Ha.. Visualization Evaluation
Current approach“ignore-for-now” approachprimarily for debuggingperceived as forced
Results
Visualization usefulness+ flow view reveals interesting patterns+ contextual view simplifies search tasks- quantitative view less clear- information about finally, rethrown exceptions
absent- questions about scalability
Survey ConclusionException Ha.. Visualization Evaluation
Improvementsscalabilityquantitative view redesign
Enhancementsshow finally related informationshow rethrown exceptions informationshow runtime exception-handling
Additional studies
Conclusion and Future Work
1. Conducted survey to understand developers needs
2. Designed a visualization with three views- Quantitative View- Flow View- Contextual View
3. Implemented visualization as an Eclipse pluginEnHanCe
4. Conducted studies to evaluate the visualization tool
Contributions
Survey ConclusionException Ha.. Visualization Evaluation
PatternsType centric
Subgraph consisting of type definition (under consideration), reachable throws, and reachable catches
Throw centricSubgraph consisting of reachable type, throw statement (under consideration), and reachable catches
Catch centricSubgraph consisting of reachable type, reachable throws, and catch (under consideration)
Helps in testing and refactoring
Extra --- EnHanCe Patterns
Survey ConclusionException Ha.. Visualization Evaluation
Quantitative view is not intuitive (difficult to understand the information it is representing, without being explained); instruction info will helpBlue shades need to be changedConfused with the columns and row reading
Extra --- Quantitative View Concerns