Friday, April 5, 2019

Clone Detection in Object Oriented Systems

Clone Detection in object Oriented Systems platform Slicing based Clone Detection in Object Oriented SystemsIshu SinglaRajesh Bhatia get up syllabus slicing is an efficient proficiency for understanding platforms by simplifying them. It is a design analysis technique that extracts a particular set of arguments relevant to any computation. For the last 25 years, the technique has found its drill in a issue forth of research beas like testing, debugging, concern etc. In this paper, we have proposed a method to use this technique for toller detecting in object orientated political programs. As program slicing concentrates only on the relevant portion of the programs based upon some criteria, this property arouse be utilized in clone detection process. For this we have used Program Dependency Graphs as an talk terms representation. These PDGs be later used to extract isomorphic overtone(p) cutting offs and finally these slices are matched to call back out potential c lones.Keywords Partial SlicesPDG Isomorphism.I. IntroductionA legislation clone represents a sequence of financial disputations that are duplicated in multiple locations of a program. Clones often arise in source code as a result of multiple cut paste operations on the source. Thus, Code clone can be considered as the act of copying code fragments and making minor, non-functional alterations in the implemented code. Code cloning increases the maintenance comprise because if in that respect is an error in the code fragment to be copied, then that error allow be propagated at contrary places. Thus, the normal functioning of the system is not affected but promote development may become prohibitively expensive 12.Pre-processing of the livelong program is often not a good choice while searching for clones. The program contains a number of irrelevant statements, thus, pre-processing will be a time consuming process 13. Also the climb up for happening clones in procedural orient ed and object oriented programs is completely different. Clone detection in object oriented programs has a number of problems 15 and sometimes follows different approach.Selecting a particular set of statements from a extended program that contains statements relevant to a particular computation is called program slicing. Thus, Program Slicing improves program understandability and find its importance in a number of applications such as software maintenance, software debugging, testing etc 35.A number of code clone detection techniques have been proposed based on text, token, graphs, trees and metrics 1. Some other techniques based on models and some hybrid techniques have also been proposed 911. The main advantage of using program slicing is that we can find the non-contiguous, intertwined code clones, where the coder changes some of the statements and the rest of the code remains unchanged in between24.II. DEFINITIONSProgram slicing was originally introduced by Weiser that define s program slicing as an analysis technique which extracts the elements of a program related to a particular computation. That set of statements collectively called as program slice. Program slices contains that parts of a program that affects the values computed at some point of interest. Program slicing automatically decomposes program by determining the data and control dependencies 38.A. SLICING CRITERIONSlicing in program is always computed on the basis of some slicing meter. We can represent slicing criterion as , where S is the statement from which the slice is to be computed and V is the variable for which the slice is to be computed and that variable must exist in the statement S 8.B. DATA DEPENDENCYStatement P is data dependent on statement Q of a program if there exists a variable m at P which is accessed also in statement Q 6. require the following example,1.x=102.y=x+cIn statement 1, we are designation a value 10 to x and in statement 2, we are using the value of x. So, there is a data dependency between the two statements 1 and 2.C. CONTROL DEPENDENCYStatement P is control dependent on statement Q if and only if statement P controls the execution of statement Q 6. Consider the following example,1.if(statement 1)2. statement 2In the above example, statement 2 will be punish if statement 1 results in true value. Thus, statement 2 is control dependent on statement 1. see to it. 1 flow chart for program slicing based clone detection.III. Clone Detection use the Program Slicing in object oriented programsFigure 1 tells the flow chart for the clone detection approach. The technique starts by taking two sample java programs. Then, the pre-processing of these programs is to be done, in which we subscribe the comments and blank spaces. Thereafter, the .class files for the normalized sample programs are generated. After this, the Program Dependency Graphs (PDGs), on the basis of control and data dependencies, are determined for the two programs. Th e program dependency graph is represented in the form of contiguousness matrix as shown in figure 2. It is an n*n matrix where n is the no of statements in the normalized program. Every institution 1 represents the data dependency between the two statements determined from the row and tugboat of the matrix. Similarly, every entry 2 represents the control dependency between two statements.Now, by having a fold up look at the adjacency matrix, it is quite clear that the matrix is sparse because the occurrence of zero is higher(prenominal) than the non-zero entries. So comparing the adjacency matrices of the two programs cant be an efficient approach. Thus, an algorithmic rule has been certain that determines the partial slices from the adjacency matrix in the form of lists.In earlier techniques for program slicing, the slicing criterion has to be defined manually to determine the slices. But, in our approach, the program slices are determined automatically on the basis of the me ntioned algorithm. Because, the slices are extracted starting from the first statement, using control and data dependencies in the adjacency matrix.Figure 2. Example of Adjacency matrix obtained from programs.A. Algorithm for Program SlicingInput- A control data dependency adjacency matrix matnn of size n*n where n is the no of statements. Every entry 1 at index matij shows that there is a data dependency between statement i and j and every entry 2 represents the control dependency between statement i and j. outturn- Partial slices in form of listsThe partial slices are extracted from the adjacency matrix, which are in the form of lists. Once, the partial slices for the two java programs are determined, we have to match them using an efficient matching algorithm. If there is cloning among the two source codes, then there must be a match between these partial slices. The matching algorithm will find out the extent of cloning between the two programs by comparing the partial slices and finally return percentage of cloning as result.IV. Related WorkIn last two decades, various algorithms have been proposed for program slicing. All have its own advantages and shortcomings. In following(a) section, an overview of recent research in the area of program slicing is furnishn.Z. Guangquan et. al proposed a method to slice the concurrent object oriented programs. In this approach the java concurrency model is used and dependencies between the statements are defined. The paper presents the method of extracting slicing criterion from linear temporal logic property and proposes the steps of figuring slicing. Multithreaded dependency graph is used for intermediate representation. A Two-pass algorithm based on Variable cache Table is adapted to compute slices by extracting out the irrelevant portions of the programs. Results show the satisfaction is guaranteed for source and sliced program and the method can be easily extended to handle other concurrency models7.R. Komo ndoor et. al. proposed a machine to detect clones in C fragments. In their approach, they used program dependence graphs and program slicing to find isomorphic PDG subgraphs. These subgraphs can be represented as clones. This tool is capable of conclusion non-continuous clones, intertwined clones and clones in which different variable names are used and statements have been reordered. The approach has been applied for the procedural oriented programs and finds many an(prenominal) variants of ideal clones. A number of test cases demonstrating the application of approach on large programs have been shown 4.A. Surendran et. al. proposed a partial slicing approach as an effective method of program testing. Partial slices are create from the combination of soundless slices and program points. In some cases static slices contains large number of program statements which are of little use in many practical applications. Partial slicing removes the disadvantage of large size of static slices. In their approach they use only static slices for the algorithm as static slices give all possible execution paths. As compared to original program there is a significant reduction in the number of statements in static slices using partial slicing. victimisation the constraints of partial slicing program testing is also simplified. This approach can also be used in debugging, maintenance and determination clones 10.D. Liang et. al. presented system dependence graph for object-oriented softwares. They have shown that their approach is to a greater extent precise than previous approaches and is more efficient to construct. It distinguishes data members that fit for different objects. It provides a way to represent data members that act as parameters and the effects of polymorphism on parameters and parameter bindings. It presents a concept of object slicing which helps in screen the statements in slice object by object. Object slicing is good technique for debugging and an alysis of large scale programs. In their lock an efficient mechanism is also provided to represent incomplete programs and to represent classes in class libraries 12.T. Ishio et. al. proposed a program debugging tool. In their approach they proposed driving slicing to efficiently localize faults in procedural oriented and object oriented programs. Aspect-oriented programming is used for collecting dynamic information in program slicing calculation. The dynamic data dependence analysis aspect can be twine into various object-oriented programs without changes as the point cuts of the aspect in the approach is made in a generic form. With the help of dynamic program analysis module, a DC slice calculation system is developed. It improves maintainability and reusability of the module. The approach has also a restriction that it does not allow to analyze the local variables and local control structures. The benefits, usability and cost effectiveness of module show that it is a good to ol for debugging 13.B. Korel et. al. presents the concept of program slicing on the module level which helps in better understanding of program slices of large programs. In this paper on call graph level, execution level and module trace level several static and dynamic program slicing features are proposed. These features can also be used during software maintenance. The concept of static and dynamic program slicing is combined with different methods of visualization which helps in understanding the program. Experiment results show that it helps the process of understanding program 14.V. CONCLUSION AND FUTURE WORKThis paper provides a technique for notice code clones in object oriented programs. For this purpose, program slicing is used as the base methodology. The algorithm uses PDGs as the intermediate representations for the source program. The PDG is represented in the form of adjacency matrix. Partial slices are extracted from the adjacency matrix and those slices are matched for possible clones.Result shows that program slicing is an efficient way for understanding programs and finding non-contiguous clones and intertwined code clones. The approach uses the control and data dependencies to find out adjacency matrix representation for the PDG. The whole process is automated where the user has to interact only once to input the programs for finding clones.Future work involves taking into consideration all the object oriented paradigm. It includes the object oriented programming features such as abstraction, encapsulation, inheritance, and polymorphism. An efficient algorithm for matching partial slices is also to be developed.REFERENCES1 Dhavleesh Rattan, Rajesh Bhatia, Maninder Singh, Software clone detection a systematic review, Information and software technology, Vol. 55, No. 7, pp. 1165-1199, 2013.2 C. K. Roy, J.R. Cordy and R. Koschke, Comparison and evaluation of code clone detection techniques and tools A qualitative approach, Science of computer programming, Vol. 74, No. 7, pp. 470-495, 2009.3 F. Tip, A Survey of Program Slicing Techniques, Journal of programing Languages, 1995, vol. 3, no. 3,pp. 121-189.4 R. Komondoor,S. Horwitz, Using Slicing to Identify Duplication in Source Code, Proceedings of the 8th multinational Symposium on Static Analysis, 2001.5 Yingzhou Zhang, Baowen Xu, Jose Emilio, Labra Gayo, A Formal Method for Program Slicing, Proceedings of the 2005 Australian Software plan Conference (ASWEC05) 1530-0803/05.6 Jens Krinke, Advanced Slicing of Sequential and Concurrent Programs, Proceedings of the 20th IEEE International Conference on Software Mai1ntenance (ICSM04) 1063-6773/04,2004.7 Z. Guangquan, R. Mei, An Approach of Concurrent Object-oriented Program Slicing Base on LTL Property, 2008 IEEE International Conference on Computer Science and Software applied science,DOI 10.1109/CSSE.2008.1283.8 M. Weiser, Program slicing, IEEE Transactions on Software Engineering, 10(4)352357, 1984.9 Dhavleesh Rattan, Rajesh Bhatia, Maninder Singh, Model clone detection based on tree comparison, India conference (INDICON), IEEE, pp. 1041 1046, 201210 A. Surendran, P. Samuel, Partial Slices in Program Testing,2012 IEEE 35th Software Engineering Workshop.11 Yogita Sharma, Rajesh Bhatia, Raj Kumar Tekchandani, Hybrid technique for object oriented software clone detection, ME thesis submitted at Thapar University, Patiala, 201112 D. Liang, M. Harrold, Slicing Objects Using System Dependence Graph, IEEE International Conference on Software Maintenance,Washington, D.C., November 1998.13 T. Ishio, S. Kusumoto,K. Inoue, Program Slicing Tool for in effect(p) Software Evolution Using Aspect-Oriented Technique, Proceedings of the Sixth International Workshop on Principles of Software Evolution, 2002 IEEE.14 B. Korel, J. Rilling, Program Slicing in Understanding of Large Programs, Program Comprehension, 1998. IWPC 98. Proceedings., 6th International Workshop.15 S. Khalsa, R. Bhatia,J. Chhabra, M. Singh, A Review of pair and Cohesion Measurement in OO Systems Using Program Slicing, ICISTM 2012, CCIS 285, pp.199-210,Springer, 2012.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.