Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ....

30
Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong

Transcript of Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ....

Page 1: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Understanding the Behavior of Java Programs

Tarja SystaSoftware Systems Lab.Tampere Univ.

Sookmyung Women’s Univ.PSLAB

Choi, yoon jeong

Page 2: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Outline of the talk

Page 3: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Outline of the talk

Introduction Dynamic modeling using SCED Collecting information Managing the explosion of the event

trace A case study

Page 4: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Intorduction

Page 5: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Introduction Dynamic reverse engineering techniques Experimental environment called Shimba SCED is a dynamic modeling tool Many dynamic reverse engineering tool

use variations of MSCs to visualize the run-time behavior of the target object-oriented sw systems

In shimba, visualization has been taken one step further Demonstrates how Shimba aids understanding the behavi

or of java program

Page 6: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Dynamic modeling using SCED

Page 7: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Dynamic modeling using SCED SCED is a prototype environment

User interaction with SCED involves two independent editors

Scenario diagram editor State diagram editor

SCED scenario diagram notation extend basic MSC notation with new concept New concept include action boxes, assertion boxe

s, state boxes, conditional constructs, repetition constructs, and subscenarios

Page 8: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Dynamic modeling using SCED

Page 9: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Collecting Information

Page 10: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Collecting information To collect event trace information

The target Java system is executed under a customized sdk debugger

Event trace information is generated when methods are called and exceptions are thrown

Reduce size of generated event trace dramatically while still containing the information of interest

In Shimba, information is extracted from the byte code Java class files

Information can be viewed and examined using the Rigi reverse engineering environment

Page 11: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Collecting information To capture the event trace

information, breakpoints are set for the debugger The dynamic control flow information

is also generated using breakpoints Conditional statements indicate the

branching points in the control flow

Page 12: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Managing the explosion of the event trace

Page 13: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Managing the explosion of the event trace

Pattern matching algorithm In Shimba, the original scenario diagrams can be

modified by applying Boyer-Moore string matching algorithm to them

Page 14: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

A Case study

Page 15: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

A case study FUJABA We use Shimba to analyze the behavior of specifi

c objects and methods and to seek answers to questions of the following form How dose a certain part of the software behave? What are the methods that have call dependencies

with this part? What is the overall run-time usage of the method o

r the object?

Page 16: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

A case study What is the dynamic control flow of the method

or the object? Was the run-time usage diversified enough to

produce information that covers all possible use cases?

How can a certain state in the object’s life be reached and how dose the execution continue?

To which messages has an object responded at a certain state during its lifetime?

Dose the run-time behavior contain regular behavioral pattern that are repeated? If it does, what are the patterns and in which circumstance do they occur?

Page 17: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Figure 2 Show a dialog box used in FUJABA for defining and editing parameters of method

By running few scripts in Rigi, the method modifiyButton_actionPerformed(ActionEvent) of class PEParameter, nodes that depend on it can be easily separated form the rest of the system. This is depicted in Figure 3.

Page 18: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Page 19: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Page 20: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method The debugger set breakpoints automatically for the metho

ds and constructors visualized in Figure 3 Dialong in Figure 2 was used for times in the following way

Figure 4 shows the scenario diagram resulting from the first case

Figure 5 show the dynamic control flow of the method modifiyButton_actionPerformed(ActionEvent),of class PEParameter, synthesized from four scenario diagrams

Page 21: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Page 22: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Page 23: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method A state diagram

It is a powerful and natural graphical representation to examine the dynamic control flow and the internal behavior of the method

Dynamic control flows are useful for detecting decision making, for profiling, for investigating code usage, etc.

Information is generated automatically based on the usage of the target software, the user can get only those pieces of information

Page 24: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method When generating information about the object int

eraction only, a smaller and slightly more abstract state diagram diagram shown in Figure 6 resultied.

Page 25: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Page 26: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Structuring scenarios with behavioral pattrens In Shimba, SCED scenario diagrams provide a vie

w and an editor to browse the exact sequential event trace information

Figure 7 shows one of the scenario diagrams after it has been modified by the scenario structuring algorithms

Page 27: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Page 28: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method Figure 8 shows the contents of the subscenario b

ox subsc_7.sc.

Page 29: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the internal behavior of a method

Page 30: Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.

Modeling the behavior of a thread