Docstoc

Dynamic Slicing of Aspect Oriented Programs using AODG

Document Sample
Dynamic Slicing of Aspect Oriented Programs using AODG Powered By Docstoc
					                                                 (IJCSIS) International Journal of Computer Science and Information Security,
                                                 Vol. 9, No. 4, April 2011




Dynamic Slicing of Aspect-Oriented Programs
               using AODG
   Sk Riazur Raheman                             Abhishek Ray                                 Sasmita Pradhan
       Dept of MCA                            School of Technology                                Dept of MCA
   REC, Bhubaneswar                             KIIT University                               REC, Bhubaneswar
       Orissa, India                              Orissa, India                                   Orissa India
  skriazur79@gmail.com                        armmclub@gmail.com                              jusasmita@gmail.com


                                                                 mainstream programming paradigm where real
Abstract - In software engineering, the programming              world problems are decomposed into objects that
paradigms of Aspect-Oriented Programming (AOP)
                                                                 have abstract behaviour and data in a single unit
attempt to aid programmers in the separation of
concerns, specifically cross-cutting concerns. All               called aspect.
programming methodologies including procedural
programming and object-oriented programming                         AOP is mainly useful in the area where code
support some separation and encapsulation of                     scattering and tangling arises. These AOP
concerns into single entities. Since such crosscutting           programs are quite large and complex. This
aspects are usually distributed among objects in                 requires to develop efficient slicing algorithms as
object-oriented programming, it is difficult to                  well as suitable intermediate representations for
maintain them consistently. In AOP they can be                   AOP.
written in a single aspect and thus easy to maintain.
This research work proposes an algorithm for
calculating the Dynamic Slice of AOP, which uses                     II.   SURVEY OF AOP SLICING TECHNIQUES
Aspect Oriented Dependence Graph (AODG) and
traversing algorithm.
                                                                     Program slicing defined by Weiser is in fact a
Keywords – AOP; Cross-cutting concern; AODG; Data                kind of executable backward static slicing. A
dependence; Control dependence; Weaving arc; Call                backward slice consists of all executable statements
arc.                                                             that the computation at the slicing criteria may
                I.   INTRODUCTION                                depend on, while a forward slice includes all
                                                                 executable statements depending on the slicing
   Program slicing was first introduced by Weiser                criterion. Since 1979, several variants of slicing,
in 1979 [3], is a decomposition technique that                   which are not static, have been proposed.
extracts from program statements relevant to a
particular computation [2]. A program slice                          Zhao [9] was the first to develop the Aspect-
consists of the parts of a program that affect the               oriented System Dependence Graph (ASDG) to
values computed at some point of interest. Such a                represent aspect oriented programs. The ASDG is
point of interest is referred to as a slicing criterion,         constructed by combining the SDG for non-aspect
and is typically consists of a pair <S, V>, where S              code, the Aspect Dependence Graph (ADG) for
is a program statement and V is a subset of                      aspect code and some additional dependence arcs
program variables [2]. There are two major kinds                 used to connect the SDG and ADG. Zhao used the
of approaches in program slicing. The first                      two-phase slicing algorithm proposed by Larsen
approach is Weiser’s [3] original slicing approach               and Harrold [6] to compute static slice of aspect-
in which slices are computed in an iterative process             oriented programs.
by computing consecutive sets of relevant variables
for each node in the CFG. The second approach is                      D P Mohapatra et al. [5] proposed a dynamic
slicing using graph reachability [1]. In this                    slicing algorithm for aspect-oriented programs,
approach slicing can be divided into two steps such              using a dependence-based representation called
as construction of dependence graph of the concern               Dynamic Aspect-Oriented Dependence Graph
program and implementing a slicing algorithm to                  (DADG)       as     the     intermediate   program
produce slices by doing graph reachablity analysis               representation. They have used a trace file to store
on them.                                                         the execution history of the program.
   AOP is a promising new technology for                            Ishio et al. [4] evaluated the usefulness of AOP
separating crosscutting concerns that are usually                in the area of program analysis. At first, the
hard to do in OOP. Recently, AOP has become the                  application of AOP to collecting dynamic



                                                           123                              http://sites.google.com/site/ijcsis/
                                                                                            ISSN 1947-5500
                                                  (IJCSIS) International Journal of Computer Science and Information Security,
                                                  Vol. 9, No. 4, April 2011




information from program execution and                              B. Proposed Algorithm
calculating program slice was examined. Then, a
program slicing system using AspectJ was                            1. Construction of Aspect-Oriented Dependence
developed,    and    benefits,   usability, cost                    Graph (AODG): Each statement of the program,
effectiveness of the module of dynamic analysis                     both aspect as well as non-aspect code will be
based on AOP was also described.                                    represented by a vertex in the AODG. AODG
                                                                    consists of four types of arcs
     Ishio et al. [11] proposed an application of a                  a. Data dependence arc
call graph generation and program slicing to assist                  b. Control dependence arc
in debugging. A call graph visualizes control                        c. Weaving arc
dependence relations between objects and aspects                     d. Call arc
and supports the detection of an infinite loop.
                                                                    2. Computation of Dynamic Slice: Traverse the
                                                                    graph taking any vertex corresponding to the
     III.   PROPOSED ALGORITHM FOR SLICING
            ASPECT-ORIENTED PROGRAMS                                statement of interest as the starting point of
                                                                    traversal based on the algorithm given in section
                                                                    3.4 for traversing.
A. Motivation
    Zhao [9] has proposed an intermediate                           C. Construction of Aspect-Oriented Dependence
representation called Aspect-Oriented System                           Graph (AODG)
Dependence Graph (ASDG) for slicing aspect
oriented software. This ASDG fails to handle the                        AOP differ from procedural or object-oriented
point-cuts properly. Zhao and Rinard [12]                           programming languages in many ways. Some of
developed an algorithm to construct the SDG for                     these differences are the concepts of join points,
aspect-oriented programs. But, the drawback of this                 advice, aspects, and their associated constructs.
SDG is that the weaving process is not represented                  These aspect-oriented features may have an impact
correctly. D P Mahapatra et al. [5] had proposed an                 on the development of the dependence-based
algorithm for dynamic slicing of aspect oriented                    representation for aspect-oriented software, and
programs. The proposed work based on Trace file                     therefore should be handled appropriately.
Based Dynamic Slicing (TBDS) algorithm for
AOP’s to store the execution history. This                               The AODG is a graph (V, A), where V is the
algorithm stores the each occurrence of a statement                 set of vertices that correspond to the statements and
in the execution trace which will take more time as                 predicates of the aspect-oriented programs, and A is
well as space. If a loop will execute for 100 times it              the set of arcs between vertices in V. The
will create the 100 vertices for each iteration.                    construction of AODG of an AOP is based on
                                                                    control flow, data flow, weaving of aspect code and
    This paper proposes an algorithm for slicing                    function call of the program.
aspect-oriented programs using Aspect-Oriented
Dependence Graph (AODG) and a new traversing
algorithm.

                          Non aspect code                                                  Aspect code
       Import java.util.*;
       Public class prime {                                          11. public aspect PrimeAspect {
       Private static int n;                                         12. public pointcut primeoperation (int n): call
       1. Public static void main(String args[]){                    (boolean prime.isprime(int) && args(n);
       2. n=Integer.parseInt(args[0]);
       3. if(isprime(n))                                             13. before (int n): primeoperation(n){
       4. System.out.println(“IS PRIME”);                            14. System.out.println(“Testing the prime
              else                                                   number for “ +n);        }
       5. System.out.prontln(“IS NOT PRIME”);
            }                                                        15. after(int n) returning (boolean result):
       6. Public static boolean isprime(int n){                      promeoperation(n){
       7. for(int i=2; i<=n/2; i++){                                 16. System.out.println(showing the prime status
       8.          If(n%i == 0)                                      for” + n);
       9.                return false;                               }
            }              }                                         }
       10. return true;
          }          }

                              Figure-1 (Aspect program to test a number is prime or not)


                                                             124                                  http://sites.google.com/site/ijcsis/
                                                                                                  ISSN 1947-5500
                                                      (IJCSIS) International Journal of Computer Science and Information Security,
                                                      Vol. 9, No. 4, April 2011




    Control dependence represents the control flow                     to store the each vertex of AODG and an array to
relationship of a program i.e, the predicates on                       store the traversed vertices. Initially the starting
which a statement or an expression depends during                      vertex based on slicing criterion will be inserted to
execution [7, 10]. Consider statements s1 and s2 in                    the queue. When a vertex is deleted from queue it
a source program p if, s1 is a conditional predicate,                  will be searched in the array if it is not present in
and the result of s1 determines whether s2 is                          the array all its adjacent vertex are inserted to the
executed or not then we say that control                               queue and the deleted vertex is added to array.
dependence (CD), from statement s1 to statement                        This process will continue until the queue is empty.
s2 exists:                                                             Finally vertices in the array give the slice.

      Data dependences represent the data flow                              1.   Insert starting node into the queue ( based
relationship of a program i.e, the flow of data                                  on slicing criterion)
between statements and expressions [8, 10].
Consider statements s1 and s2 in a source program                           2.   Create an array A to hold the traversed
p if, s1 defines v, and s2 refers to v, and at least one                         vertices. Initialize temp = queue[ front ] ,
execution path from s1 to s2 without redefining v                                ub=1and update the front pointer to delete
exists then we say that data dependence (DD),                                    the front element
from statement s1 to statement s2 by a variable v,
exists.
                                                                            3.   Repeat while temp != NULL
   Weaving arcs reflect the joining of aspect code                                  a. Intitialize i=0
and non-aspect code at appropriate join points [5].                                 b. While (( i < ub) and (A[i]!=
Call arc represents the function call.                                                     temp))
                                                                                                 i. i = i +1
     The AODG of the program in Figure-1 is given                                   c. if ( i > ub )
in Figure-2. In Figure-2, circles represent program                                     i.       ub = ub +1
statements, dotted lines represent data dependence                                     ii.      A[ub] = temp
arcs, solid lines represent control dependence arcs,                                  iii.      find all the adjacent nodes of
dark dashed lines represent weaving arcs and dark                                               temp and add them to queue
solid lines represent call arc.                                                     d. temp = queue[front] and update
                                                                                           the front pointer.
D. Algorithm for traversing
                                                                            4.   Display all the vertices in array, which
                                                                                 gives the slice.
   This paper also presents an algorithm to traverse
the AODG based on slicing criterion to find the
dynamic slice of AOP. The algorithm uses a queue



                                                                                                     Control arc
                              1                                                         12
                                                                                                     Data arc

                                                                                                     Weaving arc

                                                                                                     Call arc
                   2              3               4                  5                  1

                                                                                                            11


                                                                                        14
                                            6


                                                                                       15


                       7              8               9               10
                                                                                        16



                                          Figure-2 (AODG for the aspect program given in Figure-1)




                                                               125                                       http://sites.google.com/site/ijcsis/
                                                                                                         ISSN 1947-5500
                                                      (IJCSIS) International Journal of Computer Science and Information Security,
                                                      Vol. 9, No. 4, April 2011




                  IV.     CONCLUSIONS                                  [12]    Zhao J. and Rinard M. System Dependence Graph
                                                                               Construction for Aspect-Oriented Programs. Technical
                                                                               report,   Laboratory     for   Computer     Science,
    This paper proposed an approach to slicing                                 Massachusetts Institute of Technology, USA, March
aspect oriented software using an Aspect-Oriented                              2003.
Dependence Graph (AODG), which extends                                                       AUTHORS PROFILE
previous system dependence graphs, to represent
Aspect Oriented Programs. Also this paper                                                     Sk. Riazur Raheman has received
proposes an algorithm for traversing the                                                     his Master degree in Computer
intermediate representation AODG to find the                                                 Application and M.Tech in Comp.Sc. &
                                                                                             Engg., from KIIT University, India. He
dynamic slice of AOP.                                                                        has more than 10 years of teaching
                                                                                             experience. He is presently working as
                        REFERENCES                                                           Asst. Prof. & HOD of Department of
                                                                                             MCA, Raajdhani Engineering College,
                                                                       Bhubaneswar, India. He has published several papers in
[1]    Baowen Xu Ju Qian Xiaofan Zhang Zhongqiang Wu                   National & International Conferences. His area of interest
       Lin Chen, A Brief Survey Of Program Slicing                     includes Program Slicing, Aspect-Oriented Programs, Software
       Department of Computer Science and Engineering,                 Engineering, and Object Oriented Programming.
       Southeast University, Nanjing 210096, China, ACM
       SIGSOFT software engineering notes march - 2005.
                                                                                               Abhishek Ray has received his BE
[2]    Binkley D.W. and Gallagher K.B program         slicing.                                 in Comp. Sc. from Utkal University,
       Advances in computer, 43, 1996.                                                         India and ME in Comp. Sc. & Engg
                                                                                               from NIT Rourkela, India. Presently he
[3]    M. Weiser. Program slices: formal, psychological, and                                   is pursuing Ph.D from KIIT
       practical investigations of an automatic program                                        University, India. He has more than 12
       abstraction method. PhD thesis, University of Michigan,                                 years of teaching experience. He is
       Ann Arbor, 1979.                                                                        presently working as Asst. Prof. in
                                                                                               School     of     Technology,    KIIT
[4]    Takashi Ishio, Shinji Kusumoto, Katsuro Inoue,                  University, India. He has guided several M. Tech and B. Tech
       Application of Aspect-Oriented Programming to                   students. He has published several papers in National &
       Calculation of Program Slice, Graduate School of                International Conferences & journals. His primary research
       Information Science and Technology, Osaka University            interest includes Program Slicing, Automata and Software
       1-3    Machikaneyama, Toyonaka, Technical report,               Engineering.
       ICSE – 2003.
                                                                                               Sasmita Pradhan received her
[5]    Durga Prasad Mohapatra, Madhusmita Sahu and Rajib                                       Master degree in Computer Science
       Mall, Dynamic Slicing of Aspect-Oriented Programs,                                      from Utkal University, India and her
       informatica,2008                                                                        M. Tech degree in Computer Science
                                                                                               & Engineering from KIIT University,
[6]    Larsen L. and Harrold M. J. Slicing Object-Oriented                                     India. She is having more than 5 years
       Software. In Proceedings of 18th International                                          of teaching experience. Presently she is
       Conference on Software Engineering, pages 495–505,                                      working as a Lecturer in Dept. of
       March 1996.                                                                             MCA, Raajdhani Engineering College,
                                                                       Bhubaneswar, India. She has published several papers in
[7]    Mohapatra D. P., Mall R., and Kumar R. An Edge                  National & International Conferences. Her area of interest
       Marking Technique for Dynamic Slicing of Object-                includes Program Slicing, Aspect-Oriented Programming Fuzzy
       Oriented Programs. In Proceedings of the 28th Annual            Logic, and Object-Oriented Systems.
       International Computer Software and Applications
       Conference (COMPSAC’04), 2004.

[8]    Mohapatra D. P., Mall R., and Kumar R. A Node-
       Marking Technique for Dynamic Slicing of Object-
       Oriented Programs. In Proceedings of Conference on
       Software Design and Architecture (SODA’04), 2004.

[9]    Jianjun Zhao Slicing Aspect-Oriented Software
       Department of Computer Science and Engineering
       Fukuoka Institute of Technology, Fukuoka, Japan,
       proceedings of the 10th IEEE international workshop on
       programming comprehension pages 251 – 260 June,
       2004

[10]   G B Mund and R mall, an efficient dynamic program
       slicing technique, Information     and Software
       Technology, 2002.

[11]   Ishio, Shinji Kusumoto, Katsuro Inoue Debugging
       Support for Aspect-Oriented Program Based on
       Program Slicing and Call Graph, Proceedings of the
       20th IEEE International Conference on Software
       Mai1ntenance (ICSM’04), 2004.




                                                                 126                                    http://sites.google.com/site/ijcsis/
                                                                                                        ISSN 1947-5500

				
DOCUMENT INFO
Shared By:
Stats:
views:162
posted:5/11/2011
language:English
pages:4
Description: IJCSIS, call for paper, journal computer science, research, google scholar, IEEE, Scirus, download, ArXiV, library, information security, internet, peer review, scribd, docstoc, cornell university, archive, Journal of Computing, DOAJ, Open Access, April 2011, Volume 9, No. 4, Impact Factor, engineering, international, proQuest, computing, computer, technology