Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
1Activity
×
0 of .
Results for:
No results containing your search query
P. 1
Dynamic Slicing of Aspect Oriented Programs using AODG

Dynamic Slicing of Aspect Oriented Programs using AODG

Ratings: (0)|Views: 565|Likes:
Published by ijcsis
In software engineering, the programming paradigms of Aspect-Oriented Programming (AOP) attempt to aid programmers in the separation of concerns, specifically cross-cutting concerns. All programming methodologies including procedural programming and object-oriented programming support some separation and encapsulation of concerns into single entities. Since such crosscutting aspects are usually distributed among objects in object-oriented programming, it is difficult to maintain them consistently. In AOP they can be 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 Aspect Oriented Dependence Graph (AODG) and traversing algorithm.
In software engineering, the programming paradigms of Aspect-Oriented Programming (AOP) attempt to aid programmers in the separation of concerns, specifically cross-cutting concerns. All programming methodologies including procedural programming and object-oriented programming support some separation and encapsulation of concerns into single entities. Since such crosscutting aspects are usually distributed among objects in object-oriented programming, it is difficult to maintain them consistently. In AOP they can be 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 Aspect Oriented Dependence Graph (AODG) and traversing algorithm.

More info:

Published by: ijcsis on May 11, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

05/11/2011

pdf

text

original

 
Dynamic Slicing of Aspect-Oriented Programsusing AODG
Sk Riazur Raheman Abhishek Ray Sasmita Pradhan
Dept of MCA School of Technology Dept of MCAREC,Bhubaneswar KIIT University REC,BhubaneswaOrissa, India Orissa, India Orissa India
 skriazur79@gmail.com armmclub@gmail.com  jusasmita@gmail.com
 Abstract
-Insoftware engineering, the programmingparadigms of Aspect-Oriented Programming (AOP)attempt to aid programmers in the separation of concerns, specifically cross-cutting concerns. Allprogramming methodologies including proceduralprogramming and object-oriented programmingsupport some separation and encapsulation of concerns into single entities. Since such crosscuttingaspects are usually distributed among objects inobject-oriented programming, it is difficult tomaintain them consistently. In AOP they can bewritten in a single aspect and thus easy to maintain.This research work proposes an algorithm forcalculating the Dynamic Slice of AOP, which usesAspect Oriented Dependence Graph (AODG)andtraversing algorithm.
 Keywords –AOP;Cross-cutting concern; AODG; Data dependence;Control dependence;Weaving arc;Call  arc.
I.INTRODUCTIONProgram slicing was first introduced by Weiserin 1979 [3], is a decomposition technique thatextracts from program statements relevant to aparticular computation [2]. A
 program slice
consists of the parts of a program that affect thevalues computed at some point of interest. Such apoint of interest is referred to as a
slicing criterion
,and is typically consists of a pair <S, V>, where Sis a program statement and V is a subset of program variables [2]. There are two major kindsof approaches in program slicing.The firstapproach is Weiser’s [3] original slicing approachin whichslices are computed in an iterative processby computing consecutive sets of relevant variablesfor each node in the CFG. The second approach isslicing using graph reachability [1]. In thisapproachslicing can be divided into two stepssuchas construction of dependence graph of the concernprogram and implementing a slicing algorithm toproduce slices by doing graph reachablity analysison them.AOP is a promising new technology forseparating crosscutting concerns that are usuallyhard to do in OOP. Recently, AOP has become themainstream programming paradigm where realworld problemsare decomposed into objects thathave abstract behaviourand data in a single unitcalled aspect.AOP is mainly useful in the area where codescattering and tangling arises. These AOPprograms are quite large and complex. Thisrequires to develop efficient slicing algorithms aswell as suitable intermediate representations forAOP.II.S
URVEY OF
AOPS
LICING
T
ECHNIQUES
Program slicing defined by Weiser is in fact akind of executable backward static slicing. Abackward slice consists of all executable statementsthatthe computation at the slicing criteria maydepend on, while a forward slice includes allexecutable statements depending on the slicingcriterion. Since 1979, several variants of slicing,which are not static, have been proposed.Zhao [9] was the first to develop the Aspect-oriented System Dependence Graph (ASDG) torepresent aspect oriented programs. The ASDG isconstructed by combining the SDG for non-aspectcode, the Aspect Dependence Graph (ADG) foraspect code and some additional dependence arcsused to connect the SDG and ADG. Zhao used thetwo-phase slicing algorithm proposed by Larsenand Harrold [6] to compute static slice of aspect-oriented programs.D P Mohapatra et al. [5] proposed a dynamicslicing algorithm for aspect-oriented programs,using a dependence-based representation calledDynamic Aspect-Oriented Dependence Graph(DADG) as the intermediate programrepresentation. They have used a trace file to storethe execution history of the program.Ishio et al. [4] evaluated the usefulness of AOPin the area of program analysis. At first, theapplication of AOP to collecting dynamic
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 9, No. 4, April 2011123http://sites.google.com/site/ijcsis/ISSN 1947-5500
 
information from program execution andcalculating program slice was examined. Then,aprogram slicing system using AspectJ wasdeveloped, and benefits, usability, costeffectiveness of the module of dynamic analysisbased on AOP was also described.Ishio et al. [11]proposed an application of acall graph generation and program slicing to assistin debugging. A call graph visualizes controldependence relations between objects and aspectsand supports the detection of an infinite loop.III.P
ROPOSED
A
LGORITHM
F
OR
S
LICING
A
SPECT
-O
RIENTED
P
ROGRAMS
 A.Motivation
Zhao [9] has proposed an intermediaterepresentation called
 Aspect-Oriented System Dependence Graph
(ASDG)for slicing aspectoriented software. This ASDGfails to handle the
 point-cuts
properly. Zhao and Rinard [12]developed an algorithm to construct the SDG foraspect-oriented programs. But, the drawback of thisSDG is that the
weaving process
is not representedcorrectly. D P Mahapatra et al. [5] had proposed analgorithm for dynamic slicing of aspect orientedprograms. The proposed work based on
Trace file Based Dynamic Slicing
(TBDS) algorithm forAOP’s to store the execution history. Thisalgorithm storesthe each occurrence of a statementin the execution trace which will take more time aswell as space. If aloop will execute for 100 times itwill create the 100 vertices for each iteration.This paper proposes an algorithm for slicingaspect-oriented programsusing
 Aspect-Oriented  DependenceGraph (AODG)
and a new traversingalgorithm.
 B.Proposed Algorithm
1.
Construction of Aspect-Oriented DependenceGraph (AODG):
Each statement of the program,both aspect as well as non-aspect code will berepresented by a vertex in the AODG. AODGconsists of four types of arcsa. Data dependence arcb. Control dependence arcc. Weaving arcd. Call arc2.
Computation of DynamicSlice:
Traverse thegraph taking any vertex corresponding to thestatement of interest as the starting point of traversal based on the algorithm given in section3.4 for traversing.
C.Construction of Aspect-Oriented DependenceGraph (AODG)
AOP differ from procedural or object-orientedprogramming languages in many ways. Some of these differencesare the concepts of join points,advice, aspects, and their associated constructs.These aspect-oriented features may have an impacton the development of the dependence-basedrepresentation for aspect-oriented software, andtherefore should be handled appropriately.The AODG is a
graph
(
V, A
), where
is theset of vertices that correspond to the statements andpredicates of the aspect-oriented programs, and
 A
isthe setof arcs between vertices in
V.
Theconstruction of AODG of an AOP is based oncontrol flow, data flow, weaving of aspect code andfunction call of the program.
Non aspect code
Import java.util.*;Public class prime {Private static int n;1.Public static void main(String args[]){2.n=Integer.parseInt(args[0]);3.if(isprime(n))4.System.out.println(“IS PRIME”);else5.System.out.prontln(“IS NOT PRIME”);}6.Public static boolean isprime(int n){7.for(int i=2; i<=n/2; i++){8. If(n%i == 0)9. return false;}}10.return true;} }
Aspect code
11. public aspect PrimeAspect {12. public pointcut primeoperation (int n): call(boolean prime.isprime(int) && args(n);13. before (int n): primeoperation(n){14. System.out.println(“Testing the primenumber for +n); }15. after(int n) returning (boolean result):promeoperation(n){16. System.out.println(showing the primestatusfor” + n);}}
Figure-1 (Aspect program to test a number is prime or not)
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 9, No. 4, April 2011124http://sites.google.com/site/ijcsis/ISSN 1947-5500
 
Control dependence
represents the control flowrelationship of a program i.e, the predicates onwhich a statement or an expression depends duringexecution[7, 10].Consider statements s1 and s2 ina source program p if,s1 is a conditional predicate,andthe result of s1 determines whether s2 isexecuted or not then wesay that control
dependence (CD)
, from statement s1 to statements2 exists:
Data dependences
represent the data flowrelationship of a program i.e, the flow of databetween statements and expressions[8, 10].Consider statements s1 and s2 in a source programp if, s1 defines v, ands2 refers to v, and at least oneexecution path from s1 to s2 without redefining vexiststhen we say that
data dependence (DD)
,from statement s1 to statement s2 by a variable v,exists.
Weaving arcs
reflect the joining of aspect codeand non-aspect code at appropriate join points[5].
Call arc
represents the function call.The AODG of the program in Figure-1 is givenin Figure-2. In Figure-2, circles represent programstatements, dotted lines represent data dependencearcs, solid lines represent control dependence arcs,dark dashed lines represent weaving arcs and dark solid lines represent call arc.
 D.Algorithm for traversing
This paper also presents an algorithm to traversethe AODG based on slicing criterion to find thedynamic slice of AOP. The algorithm uses a queueto store the each vertex of AODG and an array tostore the traversed vertices. Initially the startingvertex based on slicing criterion will be inserted tothe queue.When a vertex is deleted from queue itwill be searched in the array if it is not present inthe array all its adjacent vertex are inserted to thequeue and the deleted vertex is added to array.This process will continue until the queue is empty.Finally vertices in the array givethe slice.1.Insert starting node into the queue ( basedon slicing criterion)2.Create an array A to hold the traversedvertices. Initialize temp = queue[ front ] ,ub=1and update the front pointer to deletethe front element3.Repeat while temp != NULLa.Intitialize i=0b.While (( i < ub)and(A[i]!=temp))i.i = i +1c.if ( i > ub )i.ub = ub +1ii.A[ub] = tempiii.find all the adjacent nodes otemp and add them to queued.temp= queue[front] and updatethe front pointer.4.Display all the vertices in array, whichgives the slice.
1211415161114325678910
Control arcData arcWeaving arcCall arc
 
Figure-2 (AODG for the aspect program given in Figure-1)
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 9, No. 4, April 2011125http://sites.google.com/site/ijcsis/ISSN 1947-5500

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->