Robert Tairas (INRIA & EMN) Ferosh Jacob (University of Alabama) Jeff Gray (University of Alabama) International Workshop on Software Clones (IWSC) – May.

Slides:



Advertisements
Similar presentations
MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop CSPro Overview.
Advertisements

Unification and Refactoring of Clones Giri Panamoottil Krishnan and Nikolaos Tsantalis Department of Computer Science & Software Engineering Clone images.
© 2008 by Borland Software Corp; made available under the EPL v1.0 | 17 March 2008 Introduction to the Graphical Modeling Framework Artem Tikhomirov, Borland.
1 Mind Visual Diff An architecture comparison tool December 16 th, 2014 – v0.2.2 Seyvoz Stephane Assystem.
Software Development Tools COMP220/COMP285 Seb Coope Ant and XML: Getting Started These slides are mainly based on “Java Development with Ant” - E. Hatcher.
Concepts of Database Management Seventh Edition
Reverse Engineering © SERG Code Cloning: Detection, Classification, and Refactoring.
Improving the Unification of Software Clones Using Tree & Graph Matching Algorithms Giri Panamoottil Krishnan Supervisor: Dr. Nikolaos Tsantalis
Aligning Business Needs, Processes and more within the SharePoint platform ITP116, CIO116, PM116, IA116.
ACM Southeast Conference Melbourne, FL March 11, 2006 Phoenix-Based Clone Detection using Suffix Trees Robert Tairas
Computers: Tools for an Information Age
Designing a Database Unleashing the Power of Relational Database Design.
SMIILE Finaly COBOL! and what else is new Gordana Rakić, Zoran Budimac.
Executive Dashboard Systems Secure CITI Adam Zagorecki April 30, 2004.
Noadswood Science,  To set out and solve an identified problem Monday, August 10, 2015 Box ‘a’Box ‘b’ 23 Box a is smaller than Box b…
Microsoft Visual Studio 2012 | Code Tips Usman ur Rehman Ahmed Audience Marketing Manager (AMM), Microsoft Pakistan.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Getting started with Eclipse By Alexander Butyaev.
Introduction to Data Structures. Data Structures A data structure is a scheme for organizing data in the memory of a computer. Some of the more commonly.
MS Access Advanced Instructor: Vicki Weidler Assistant:
Java Beans.
WorkPlace Pro Utilities.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Screens appear here to display the: Data Tables Plots Bibliographic Info Add New Data Form, Molecular Structure-Drawing Form ‘Tree’ for navigation between.
AS Computing Software definitions.
1 CSE 2102 CSE 2102 CSE 2102: Introduction to Software Engineering Ch9: Software Engineering Tools and Environments.
Where Innovation Is Tradition SYST699 – Spec Innovations Innoslate™ System Engineering Management Software Tool Test & Analysis.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training course describes how to configure the the C/C++ compiler options.
Mapping Designs to Code Larman, Chapter 20 CSE432 Object Oriented Software Engineering.
Static Control-Flow Analysis for Reverse Engineering of UML Sequence Diagrams Atanas (Nasko) Rountev Ohio State University with Olga Volgin and Miriam.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
FlowString: Partial Streamline Matching using Shape Invariant Similarity Measure for Exploratory Flow Visualization Jun Tao, Chaoli Wang, Ching-Kuang Shene.
Robotics Simulation (Skynet) Andrew Townsend Advisor: Professor Grant Braught.
Lattice Technology New Product Feature Highlights July 2010 Product Release.
Workbench Overview Dwight Deugo Nesa Matic
Copyright © Curt Hill Java Looking at our first console application in Eclipse.
2002/12/11PROFES20021 On software maintenance process improvement based on code clone analysis Yoshiki Higo* , Yasushi Ueda* , Toshihiro Kamiya** , Shinji.
Exceptions in Java. Exceptions An exception is an object describing an unusual or erroneous situation Exceptions are thrown by a program, and may be caught.
Recovering Design Technical Debt from Source Code Comments Department of Computer Science and Software Engineering Concordia University Montreal, Canada.
McLab Tutorial Part 3 – McLab Frontend Frontend organization Introduction to Beaver Introduction to JastAdd 6/4/2011 Frontend-1McLab.
With Jeff Gray and Ira Baxter Robert Tairas Visualization of Clone Detection Results Eclipse Technology Exchange Workshop OOPSLA 2006 Portland, Oregon.
Duplicate code detection using anti-unification Peter Bulychev Moscow State University Marius Minea Institute eAustria, Timisoara.
Weaving a Debugging Aspect into Domain-Specific Language Grammars SAC ’05 PSC Track Santa Fe, New Mexico USA March 17, 2005 Hui Wu, Jeff Gray, Marjan Mernik,
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Understanding the Behavior of Java Programs Tarja Systa Software Systems Lab. Tampere Univ. Sookmyung Women’s Univ. PSLAB Choi, yoon jeong.
Gordana Rakić, Zoran Budimac
Exceptions Chapter 16 This chapter explains: What as exception is Why they are useful Java exception facilities.
Cross Language Clone Analysis Team 2 February 3, 2011.
Page 1 – Autumn 2009Steffen Vissing Andersen SDJ I1, Autumn 2009 Agenda: Java API Documentation Code Documenting (in javadoc format) Debugging.
Computer Science 209 Software Development Handing Errors and Creating Documentation.
Devanshu Bawa Customization Specialist Logo Business Solutions.
Cross Language Clone Analysis Team 2 February 3, 2011.
Virtual Navigation of Multimedia Maps A versatile map generator and viewer Virtual Navigation of Multimedia Maps A versatile map generator and viewer Robert.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
1 Management Information Systems M Agung Ali Fikri, SE. MM.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED FORMS.
Software Engineering Lab (LabSoft) 1/29 On The Detection of Code Clone With Concern Analysis Paiva, Alexandre; Alves, Johnatan;
Lecture 3.1: Operator Precedence and Eclipse Tutorial Michael Hsu CSULA.
INTRODUCTION TO DATA STRUCTURES 1. DATA STRUCTURES A data structure is a scheme for organizing data in the memory of a computer. Some of the more commonly.
Semi-Automated Software Restructuring
Atanas (Nasko) Rountev Ohio State University
Parsing & Context-Free Grammars
A Refactoring Technique for Large Groups of Software Clones
Critics: An Interactive Code Review Tool for
: Clone Refactoring Davood Mazinanian Nikolaos Tsantalis Raphael Stein
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Java Looking at our first console application in Eclipse
Presentation transcript:

Robert Tairas (INRIA & EMN) Ferosh Jacob (University of Alabama) Jeff Gray (University of Alabama) International Workshop on Software Clones (IWSC) – May 23, 2011 Representing Clones in a Localized Manner © AtlanMod | This material is based upon work supported by the National Science Foundation under Grant No. CCF

Problem: Clone Comprehension  Clones in a group can be scattered – Within a large source file or in several files – A programmer must view clones in each location 2 Cloned Code

Representation within Source Editor  From the refactoring perspective: – Eclipse refactoring requires multiple dialog boxes – Separation between editor and refactoring tasks – A solution: visualize refactoring changes directly in the source editor 3 Screen shot of Refactor! Pro † † Refactor! Pro, 2010

Localized Clone Representation  Represent a clone group in a localized manner directly in the source editor – Parameterized differences visualized in representation 4 if (!delete(file)) { String message = "Unable to delete file " + file.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } if (!delete(file)) { String message = "Unable to delete file " + file.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } if (!delete(f)) { String message = "Unable to delete file " + f.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } if (!delete(f)) { String message = "Unable to delete file " + f.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } if (!delete(f)) { String message = "Unable to delete file " + f.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } if (!delete(f)) { String message = "Unable to delete file " + f.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } if (!delete(dir)) { String message = "Unable to delete directory " + dir.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); } if (!delete(dir)) { String message = "Unable to delete directory " + dir.getAbsolutePath(); if (failonerror) { throw new BuildException(message); } else { log(message, quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); }

Displaying Clones in a Localized Manner 5 Original Source Code User Selects a Clone Group Clone Group Generate Suffix Tree Generate Suffix Tree Clone Differences Localized Representation Generate Representation Generate Representation  Determine differences among the clones  Differences based on first-level statement comparisons  Determine differences among the clones  Differences based on first-level statement comparisons  Performed by third-party tool Clone Groups Clone Detection  Localized representation is displayed after a user selects a clone group  Representation “re-calculated” when a different clone group is selected  Localized representation is displayed after a user selects a clone group  Representation “re-calculated” when a different clone group is selected

Detecting Parameterized Elements  A suffix tree is generated on the AST nodes representing the statements of a group of clones  Elements in nodes containing allowed differences are mapped together 6 Stmt1 $ $ Clone 1 $ $ # # Stmt1 Stmt2 Stmt1 # # Clone 2 Stmt2 Excerpt of suffix tree file → dir file.getAbsolutePath()dir.getAbsolutePath() Parameterized elements mapped

Statement Similarity Levels  Comparing two statements of two clones – Level 1: Corresponding nodes match each other exactly – Level 2: Corresponding nodes are identical, but can contain allowed parameterized differences  i.e., MethodInvocation, NumberLiteral, QualifiedName, SimpleName, or StringLiteral – Level 3: Corresponding nodes are not identical, but both correspond to types from the Level 2 comparison  e.g., a MethodInvocation is matched with a SimpleName. 7

Similarity Levels in Representation  Statement 1 in Clone 1 – Exact matching nodes with Statement 1 in Clone 2 8 Clone 2

Similarity Levels in Representation  Statement 2 in Clone 1 – Non-matching nodes with Statements 2 and 3 in Clone 2 9 Clone 2

Similarity Levels in Representation  Statement 3 in Clone 1 – Parameterized identical and non-identical nodes with Statement 4 in Clone 2 10 Clone 2

Similarity Levels in Representation  Statement 4 in Clone 1 – Non-matching nodes with Statement 5 in Clone 2 11 Clone 2

Example Representations  Sub-groups of clones – Tighter similarities: Clones 1 and 4 vs. Clones 2 and 3 12 for (int i = 0; i < params.length; i++) { if (CONTAINS_KEY.equals(params[i].getType())) { contains.addElement(params[i].getValue()); } for (int i = 0; i < params.length; i++) { if (CONTAINS_KEY.equals(params[i].getType())) { contains.addElement(params[i].getValue()); } Clone 1 for (int i = 0; i < params.length; i++) { if (COMMENTS_KEY.equals(params[i].getType())) { comments.addElement(params[i].getValue()); } for (int i = 0; i < params.length; i++) { if (COMMENTS_KEY.equals(params[i].getType())) { comments.addElement(params[i].getValue()); } Clone 4 for (int i = 0; i < params.length; i++) { if (PREFIX_KEY.equals(params[i].getName())) { prefix = params[i].getValue(); break; } for (int i = 0; i < params.length; i++) { if (PREFIX_KEY.equals(params[i].getName())) { prefix = params[i].getValue(); break; } Clone 2 for (int i = 0; i < params.length; i++) { if (LINE_BREAKS_KEY.equals(params[i].getName())) { userDefinedLineBreaks = params[i].getValue(); break; } for (int i = 0; i < params.length; i++) { if (LINE_BREAKS_KEY.equals(params[i].getName())) { userDefinedLineBreaks = params[i].getValue(); break; } Clone 3

Clone Properties Based on Visualizations 13 Quick summary of clone differences in large clones Quick summary of neighboring clones Identifying an “oddball” clone

Evaluation: Fully Representing Clones  Considers the number of clone groups (i.e., #CG) that can be appropriately represented – Evaluated on multiple open source Java projects 14 Project#CGExact (%)Param (%)StmtDiff (%)Mixed (%) Apache Ant (14%)152 (35%)131 (31%)85 (20%) ArgoUML (9%)214 (33%)124 (19%)251 (39%) Jakarta-JMeter (20%)158 (42%)71 (19%) JBoss AOP (32%)81 (51%)14 (9%)13 (8%) JFreeChart (18%)415 (49%)168 (20%)113 (13%) JRuby (36%)70 (22%)63 (20%)72 (23%) EMF (19%)136 (48%)52 (18%)42 (15%) JEdit (26%)120 (35%)88 (26%)46 (13%) Squirrel-SQL (18%)164 (38%)70 (16%)116 (27%)

Evaluation: Fully Representing Clones  Exact  Clones that match each other exactly 15 Project#CGExact (%)Param (%)StmtDiff (%)Mixed (%) Apache Ant (14%)152 (35%)131 (31%)85 (20%) ArgoUML (9%)214 (33%)124 (19%)251 (39%) Jakarta-JMeter (20%)158 (42%)71 (19%) JBoss AOP (32%)81 (51%)14 (9%)13 (8%) JFreeChart (18%)415 (49%)168 (20%)113 (13%) JRuby (36%)70 (22%)63 (20%)72 (23%) EMF (19%)136 (48%)52 (18%)42 (15%) JEdit (26%)120 (35%)88 (26%)46 (13%) Squirrel-SQL (18%)164 (38%)70 (16%)116 (27%)

Evaluation: Fully Representing Clones  Param  Groups with parameterized differences – Majority of the cases except ArgoUML and JRuby – Four cases almost half of the instances 16 Project#CGExact (%)Param (%)StmtDiff (%)Mixed (%) Apache Ant (14%)152 (35%)131 (31%)85 (20%) ArgoUML (9%)214 (33%)124 (19%)251 (39%) Jakarta-JMeter (20%)158 (42%)71 (19%) JBoss AOP (32%)81 (51%)14 (9%)13 (8%) JFreeChart (18%)415 (49%)168 (20%)113 (13%) JRuby (36%)70 (22%)63 (20%)72 (23%) EMF (19%)136 (48%)52 (18%)42 (15%) JEdit (26%)120 (35%)88 (26%)46 (13%) Squirrel-SQL (18%)164 (38%)70 (16%)116 (27%)

Evaluation: Fully Representing Clones  StmtDiff  Groups with statement differences  Mixed  Groups containing both Param and StmtDiff 17 Project#CGExact (%)Param (%)StmtDiff (%)Mixed (%) Apache Ant (14%)152 (35%)131 (31%)85 (20%) ArgoUML (9%)214 (33%)124 (19%)251 (39%) Jakarta-JMeter (20%)158 (42%)71 (19%) JBoss AOP (32%)81 (51%)14 (9%)13 (8%) JFreeChart (18%)415 (49%)168 (20%)113 (13%) JRuby (36%)70 (22%)63 (20%)72 (23%) EMF (19%)136 (48%)52 (18%)42 (15%) JEdit (26%)120 (35%)88 (26%)46 (13%) Squirrel-SQL (18%)164 (38%)70 (16%)116 (27%)

Summary  Clone group representation localized on just one clone instance directly in the source editor – Provides a quick summary of the clone properties – No need to open every occurrence of each clone – Evaluated artifacts show that > 50% of groups are fully represented  Remaining groups with non-supported parameterized elements still identified appropriately  Future work – Recognize more parameterized elements to reduce the number of non-matched statements – Determine the extent that the representation can be utilized without becoming just cluttered and less useful 18

Key Need Emerging from this Work  Many clone detection and analysis tools present results in a proprietary format  This makes it very challenging to chain tools together and to build new functionality  A strong need is a common standard format for representing results of clone tools  Questions: – Why is it that such a standard is not emerging as a widespread need for this community? – What is needed to get tool providers to consider efforts like the Rich Clone Format (RCF)? 

Thank You  Personal: –  Code Clones Literature: –  Code Clones Literature (RSS Feed): – 20