Visualization of Exception Handling Constructs to Support...

40
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)

Transcript of Visualization of Exception Handling Constructs to Support...

Page 1: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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)

Page 2: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

• 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

Page 3: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

• 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

Page 4: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Exception handling in JavaSurveyVisualizationEvaluationConclusion

Outline

Page 5: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

Outline

Exception handling in JavaSurveyVisualizationEvaluationConclusion

Page 6: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

}}

Page 7: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 8: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 9: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 10: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 11: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 12: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 13: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 14: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 15: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 16: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 17: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 18: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 19: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 20: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 21: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 22: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 23: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 24: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 25: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

Quantitative View - NanoXML

1 2-5 6-10 11-15 15-20

Page 26: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

}}

Page 27: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 28: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

Flow View - NanoXMLXMLParseExceptiontype

throw

catchEXIT

Page 29: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

Contextual ViewPackageMethod Class

Page 30: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

Contextual View - NanoXML

skipBogusTag () parse ()

Page 31: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

Three Visualizations

Program analysis tool

X

Page 32: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 33: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

EnHanCe Screenshot

Page 34: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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)

Page 35: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 36: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

Survey ConclusionException Ha.. Visualization Evaluation

Improvementsscalabilityquantitative view redesign

Enhancementsshow finally related informationshow rethrown exceptions informationshow runtime exception-handling

Additional studies

Conclusion and Future Work

Page 37: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 38: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student
Page 39: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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

Page 40: Visualization of Exception Handling Constructs to Support …hinashah/documents/shah_goerg_harrold... · 2008-10-03 · Software Developer Project Manager Test Engineer Student

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