Title: Extracting Sequence Diagram from Execution Trace of Java Program
1Extracting Sequence Diagram from Execution Trace
of Java Program
Koji Taniguchi , Takashi Ishio,Toshihiro
Kamiya, Shinji Kusumoto, Katsuro
Inoue Osaka University, Japan Japan Science
and Technology Agency, Japan
2Documents of Evolving Software
- Software is being changed by fixing bugs,
modifying functions or adding new functions - Owing to such changes
- No documents may represent the behavior of the
software correctly because the software is
repeatedly changed but the documents are not
updated - It makes understanding of program behavior
difficult. - Especially in object oriented programs
- We need reverse engineering techniques to recover
some documents from a program.
3Object Oriented Program Understanding
- Features of Object Oriented Program
- Many objects are concerned with a function
- Owing to dynamic binding and extending, dynamic
behavior of a program differs from static
description - Message exchanges become more compress as
increases of objects - It is difficult to understand dynamic behavior of
objects from source codes - We need some documents that show dynamic behavior
of objects
4Visualizing Dynamic Behavior of Objects
- UML Sequence Diagram
- It shows two kind of messages
- Method Call
- Object Generation
- Showing this diagram, we can understand dynamic
behavior of objects - We try to extract sequence diagram by dynamic
analysis of a program
5A Problem of Dynamic Analysis
- The amount of information of an execution trace
is very huge - Because an execution trace is recorded all method
calls which occurred in loop and recursive call
structures. - If we show all of them in a diagram, we can not
understand easily - We need a method to reduce information
- We propose a method that detects some repetition
patterns from execution trace and abstracts them
by replacing with a representative of a repetition
6How to Extract Sequence Diagram
- Get the execution trace
- Compact the execution trace
- Draw the Sequence Diagrams from the compacted
execution trace
7Step1 Execution Traces
- The execution trace records the two event Enter
Method and Exit Method - we treat the constructor as the one kind of the
method - Recorded information
- When a Enter Method event occurred
- Package name, Class name and Object-ID of a
callee object - Signature of a method.
- When a Exit Method event occurred
- The method exit mark
8Step2 Compaction of Execution Trace
- Since an execution trace records many
information, we need a method to reduce it - Our method detects some repetitions from
execution trace and abstracts them by replacing
with a representative of repetition - To compact the execution trace, we propose four
Compaction Rules - Rules that compact some repetition patterns
- R1 Completely same repetition
- R2 Allowing different objects repetition
- R3 Lack of method calls repetition
- Rule that compacts recursive calls
- R4 Recursive call structure
9Rule R1 Completely Same Repetition
- R1 compacts a repetition of completely same
method call structure
first time of the repetition
second time of the repetition
10Rule R2 Allowing Different Objects Repetition
- R2 compacts a repetition of method call structure
whose objects may be different
first time of the repetition
second time of the repetition
11Rule R3 Lack of Method Calls Repetition
- R3 compacts a repetition of method call structure
some of whose method calls may be lacked
first time of the repetition
second time of the repetition
12Rule R4 Recursive Call Structure
- R4 compacts recursive call structure by
reconstructing it to be simple - R4 also not considers object ID
13Step3Drawing Sequence Diagram
- Draw a sequence diagram from a compacted
execution trace - We define annotation symbols for each compaction
rule - Compacted parts are drawn with them in the
sequence diagram
14How to draw non-compacted parts
15Annotation for R1
R1
2
16Annotation for R2
R2
2
A1
B2,3
a()
b()
17Annotation for R3
2
R3
?
18Annotation for R4
R4
R
?
A1,2
B3,4
rec a()
a()
rec a()
b()
19Case Study
- Case study processes as followings
- Get execution traces from four Java program
- jEditText Editor
- GeminiCode clone analyzer
- SchedulerSchedule management tool
- LogCompactorThe module of our tool that compacts
execution traces - Apply four rules to four execution traces.
- The order of applying rules is R4?R1?R2?R3
- Generate Sequence Diagrams
20Result of Compaction
21Sequence Diagram
Over View of the Diagram
22Unified objects
Repetition
23Summary
- For Object Oriented program understanding
- It is necessary to understand dynamic behavior of
objects. - We try to make sequence diagrams from execution
trace - The amount of the program execution trace tends
to be very large - We proposed a method to reduce information by
compacting repetition part of the execution
trace. - Draw the sequence diagram from the compacted
execution trace - We can extract the simple sequence diagram that
shows dynamic behavior of objects
24End
25Compaction (3)
Method
- The prot of the methods which recorded the
compacted execution trace of Gemini - The execution trace of Gemini was most compacted
one. - But we can see some repetition of the method
calls remain. - We need the more effective compaction rules
26(No Transcript)
27(No Transcript)