Download presentation
Presentation is loading. Please wait.
Published byErika Briggs Modified over 9 years ago
1
Strategies to relate the program and problem domains using code instrumentation Mario Marcelo Berón University of Minho Pedro Rangel Henriques University of Minho Maria João Varanda Pereira Polytechnic Institute of Bragança Roberto Uzal University of San Luis MICEI Braga – Portugal MICEI-University of Minho
2
Motivation In the context of PCVIA, we want to explore and implement code inspection approaches and tools for Program Comprehension activities. We will give special attention to approaches that support the mapping between behavioral and operational views of programs. We will present a code instrumentation based strategy. MICEI-University of Minho
3
Topics Program Comprehension: concepts and tools Program Comprehension Approach Strategy to relate different views Case Study: EAR (Un Evaluador de Algoritmos de Ruteo) Conclusion Future Work MICEI-University of Minho
4
Program Comprehension Software Engineering discipline which aims at understanding computer code written in a high-level programming language. Program Comprehension is useful for reuse, maintenance, reverse engineering and many other activities in the context of Software Engineering. MICEI-University of Minho Program Comprehension Concept and tools
5
Program Comprehension Tool A program that aims at making the understanding of a software application easier, through the presentation of different perspectives (views) of the overall system or its components. MICEI-University of Minho
6
A PC Tool has modules to: Extract information by parsing the source code Store and handle the information extracted Visualize all the retrieved information MICEI-University of Minho Program Comprehension Concept and tools
7
General purpose Eclipse SDK Visual Studio. Net Domain specific SHriMP Creole Jeliot 3 Imagix 4D Codesurfer MICEI-University of Minho Program Comprehension Concepts and tools
8
MICEI-University of Minho Program Comprehension Concepts and tools Views: System representations that help the user to understand the systems under analysis Interesting Views Machine (ex. Byte Code, Assembly Code) Program (ex. C code, Java code) Functions and data used in runtime Function Graph Module Graph Effect on the problem domain (behavioral)
9
MICEI-University of Minho Program Comprehension Concepts and tools
10
Topics Program Comprehension: concepts and tools Program Comprehension Approach Strategy to relate different views Case Study: EAR (Un Evaluador de Algoritmos de Ruteo) Conclusion Future Work MICEI-University of Minho
11
Code Inspection by Instrumentation Consists in the insertion of useful statements into the source code to get runtime (dynamic) information that allows us to follow program execution. MICEI-University of Minho
12
Instrumentation: Inspector Function: inserted at check points (begin and end of functions). Iteration Control Statements: inserted before inside and after cyclic statements. MICEI-University of Minho Code Inspection by Instrumentation
13
MICEI-University of Minho Code Inspection by Instrumentation Function Handling int f (int x, int y) { float z,k; /* more declarations*/ INPUT_INSPECTOR( “ f ” ); ……… /* actions */ OUTPUT_INSPECTOR( “ f ” ); return value; } int f (int x, int y) { float z,k; /* more declarations*/ ……… /* actions */ return value; }
14
MICEI-University of Minho Code Inspection by Instrumentation Function Handling for(initialization, condition, action) actions; { 1 for (initialization; condition; action) { actions; 2 } 3 } 1.push(s,numberOfTimes) 2.v=pop(s); v=v-1; push(s,v) 3.pop(s)
15
MICEI-University of Minho Code Inspection by Instrumentation Data Handling int a; int f (int x, int y) { float z,k; /* more declarations*/ INPUT_INSPECTOR( “ f ”,data ); ……… /* actions */ OUTPUT_INSPECTOR( “ f ”,data ); return value; } data
16
MICEI-University of Minho Code Inspection by Instrumentation Data Handling long int (*f([][])(int, int (float *[],int []);
17
Topics Program Comprehension: concept and tools Program Comprehension Approach Strategy to relate different views Case Study: EAR (Un Evaluador de Algoritmos de Ruteo) Conclusion Future Work MICEI-University of Minho
18
Relationship between Views MICEI-University of Minho The relationship between different levels of the architecture can be made using the information available in the information repository. The problem appear when we want to relate the Operational and Behavioral views. In this case we can use BORS.
19
BORS Behavioral-Operational Relation Strategy Program Output Used Functions to build the output Behavioral View Operational View ? The used functions to build the output are known but: What about each object in the problem domain? Is it possible to recover the functions used to build each object? MICEI-University of Minho
20
Program Output Used Functions to build the output Behavioral View Operational View ! Objects + Interface Nodes Node Functions Arcs Arc Functions................................. Function execution tree MICEI-University of Minho BORS Behavioral-Operational Relation Strategy
21
1.Detect the functions related with each Problem Domain Object. 2.Build an fe-tree (Functions Execution Tree) with the used functions in runtime. 3.Explain the functions found in step 1 using the tree built in step 2. MICEI-University of Minho BORS Procedure
22
BORS: Step 1 Detecting the functions related with the domain objects The Grep technique allow us to get all the functions related (by name) with an object (syntactic matching). The programmer must analyze if the recovered functions are semantically related with the object under consideration. Important: This process would be easier if the system under study was implemented using Abstract Data Types. MICEI-University of Minho
23
BORS: Step 2 Build a fe-Tree The functions used at runtime to build the output can be obtained through source code instrumentation. Our annotation scheme inserts “inspector functions” at the beginning and at the end of each functions present in the source code. With these information we can build a tree denominated fe-Tree. MICEI-University of Minho
24
BORS: Step 3 Explain the functions using the fe-tree MICEI-University of Minho
25
Topics Program Comprehension: concept and tools Program Comprehension Approach Strategy to relate different views Case Study: EAR (Un Evaluador de Algoritmos de Ruteo) Conclusion Future Work MICEI-University of Minho
26
Program Comprehension Concepts and tools EAR: Integrated Environment
27
MICEI-University of Minho Program Comprehension Concepts and tools Function Graph of EAR
28
MICEI-University of Minho Program Comprehension Concepts and tools Module Graph of EAR System
29
MICEI-University of Minho Program Comprehension Concepts and tools Function Graph of Morelia Module
30
Case Study EAR: Module Graph MICEI-University of Minho
31
Case Study EAR: Function Graph by Module with different abstraction levels
32
MICEI-University of Minho Case Study EAR:BORS applied to plannar graph
33
Topics Program Comprehension: concept and tools Program Comprehension Approach Strategy to relate different views Case Study: EAR (Un Evaluador de Algoritmos de Ruteo) Conclusion Future Work MICEI-University of Minho
34
Conclusions MICEI-University of Minho The use of inspector functions (IF), weaved into the source code, allows us to capture the actual flow of the functions during execution. To control the size of the output list of functions generated by the inpection, we adopted a suitable strategy based on the weaving of iteration control statements (ICS). Both IF and ICS were inserted into the source code in a systematic instrumentation strategy that could be done automatically.
35
Conclusions MICEI-University of Minho With our approach we can obtain many different views of EAR, very useful to study and understand the system. Statcis: Assembly code Source code Function graph Module graph Dynamics: Runtime functions Trace to module level Trace to function level
36
MICEI-University of Minho Conclusions BORS is useful to relate the behavioral and operational views and to create a true aid for Program Comprehension. BORS can be totally automatized if the programming paradigm is object oriented.
37
Topics Program Comprehension: concept and tools Program Comprehension Approach Strategy to relate different views Case Study: EAR (Un Evaluador de Algoritmos de Ruteo) Conclusion Future Work MICEI-University of Minho
38
Future Work MICEI-University of Minho It is necessary to develop a more robust data structure to handle the recovered information from our instrumentation scheme. To develop strategies to decorate the algorithms output. In other words to show the behavioral-operational relation explicitly. To implement metrics to help the programmer to select the input for BORS.
39
MICEI-University of Minho Future Work To identify the domain objects. To assess our tool, collecting experimental indicators about its use for program understanding.
40
Thanks you for your attention Mario M. Berón Pedro Rangel Santos Henriques Maria João Varanda Pereira Roberto Uzal MICEI-University of Minho
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.