cross language clone analysis team 2 november 10, 2010

37
Presentation 6 Cross Language Clone Analysis Team 2 November 10, 2010

Upload: iris-bishop

Post on 06-Jan-2018

222 views

Category:

Documents


0 download

DESCRIPTION

 Allen Tucker  Patricia Bradford  Greg Rodgers  Brian Bentley  Ashley Chafin 3

TRANSCRIPT

Page 1: Cross Language Clone Analysis Team 2 November 10, 2010

Presentation 6Cross Language Clone Analysis

Team 2November 10, 2010

Page 2: Cross Language Clone Analysis Team 2 November 10, 2010

• Current Tasks• Parsing & CodeDOM• Clone Analysis• Unit Testing• Team Collaboration• Path Forward

Agenda

2

Page 3: Cross Language Clone Analysis Team 2 November 10, 2010

Allen Tucker Patricia Bradford Greg Rodgers Brian Bentley Ashley Chafin

Our Team

3

Page 4: Cross Language Clone Analysis Team 2 November 10, 2010

Current TasksWhat we are tackling…

4

Page 5: Cross Language Clone Analysis Team 2 November 10, 2010

Current tasks created for the first user story “Source Code Load & Translate”:◦ Load & parse C#, Java, C++ source code.◦ Translate the parsed C#, Java, C++ source code

to CodeDOM.◦ Associate the CodeDOM to the original source

code. Current tasks created for the second user

story “Source Code Analyze”:

Current Tasks (Review)

5

Page 6: Cross Language Clone Analysis Team 2 November 10, 2010

UML Model – Load & Parse

6

Page 7: Cross Language Clone Analysis Team 2 November 10, 2010

UML Model – Translate

7

Page 8: Cross Language Clone Analysis Team 2 November 10, 2010

UML Model – Associate

8

Page 9: Cross Language Clone Analysis Team 2 November 10, 2010

Parsing & CodeDOMGOLD Parsing Populating CodeDOM

9

Page 10: Cross Language Clone Analysis Team 2 November 10, 2010

Task Understanding Three Step Process• Step 1 Code Translation

• Step 2 Clone Detection

• Step 3 Visualization

Source Files Translator Common

Model

Common Model Inspector Detected

Clones

Detected Clones UI Clone

Visualization

10

Page 11: Cross Language Clone Analysis Team 2 November 10, 2010

Grammar Updates Currently the grammars we have for the

Gold parser are out dated.

Current Gold Grammars◦ C# version 2.0◦ Java version 1.4

Current available software versions◦ C# version 4.0◦ Java version 6

11

Page 12: Cross Language Clone Analysis Team 2 November 10, 2010

Grammars for C# and Java are very complex and require a lot of work to build.

Antler and Gold Parser grammars use completely different syntax.

Positive note: Other development not halted by use of older grammars.

Grammar Update Issues

12

Page 13: Cross Language Clone Analysis Team 2 November 10, 2010

What’s in CodeDOM (Java Code)

13

Page 14: Cross Language Clone Analysis Team 2 November 10, 2010

Since there are so many production rules, we came up with the following bookkeeping:

A spreadsheet of the compiled grammar table (for each language) with each production rule indexed.◦ This spreadsheet covers:

various aspects of language what we have/have not handled from the parser what we have/have not implemented into CodeDOM percentage complete

Our Grammar Bookkeeping

14

Page 15: Cross Language Clone Analysis Team 2 November 10, 2010

Our Grammar Bookkeeping

15

Page 16: Cross Language Clone Analysis Team 2 November 10, 2010

Parsing Handlers’ Status:◦ C# = 52% complete◦ Java = 100% complete

CodeDOM Translation Status:◦ We currently do not believe we can give an

accurate measure of our completeness on this. It is a learning process, and we are working hard to complete it.

◦ We are working on the CodeDOM translation for Java currently. (We will demo)

Parsing & CodeDOM Status

16

Page 17: Cross Language Clone Analysis Team 2 November 10, 2010

As of Nov 8, 2010 Sloc:

◦ CS666_Client = 510 lines◦ CS666_Core = 114 lines◦ CS666_CppParser = 117 lines◦ CS666_CsParser = 1678 lines◦ CS666_JavaParser = 3182 lines◦ CS666_LanguageSupport = 48 lines◦ CS666_Tests = 0 lines◦ CS666_UnitTests = lines

Total = 5649 lines (excluding unit tests)

SLOC For Our Project

17

Page 18: Cross Language Clone Analysis Team 2 November 10, 2010

Clone AnalysisDr. Kraft’s Student’s Tool

18

Page 19: Cross Language Clone Analysis Team 2 November 10, 2010

Detecting clones across multiple programming languages is on the cutting edge of research.

A preliminary version of this was done by Dr. Kraft and his students for C# and VB.◦ They compared the Mono C# parser (written in C#) to the

Mono VB parser (written in VB).◦ Publication:

Nicholas A. Kraft, Brandon W. Bonds, Randy K. Smith: Cross-language Clone Detection. SEKE 2008: 54-59

Clone Research

19

Page 20: Cross Language Clone Analysis Team 2 November 10, 2010

Token sequence of CodeDOM graphs with Levenshtein distance◦ The Levenshtein distance between two sequences is

defined as the minimum number of edits needed to transform one sequence into the other

Performs Comparisons of code files CodeDOM tree is tokenized Based on Distances

◦ Percentage of matching tokens in a sequence

Dr. Kraft Approach

20

Page 21: Cross Language Clone Analysis Team 2 November 10, 2010

Dr. Kraft Approach (cont)

21

Page 22: Cross Language Clone Analysis Team 2 November 10, 2010

◦About 50% complete porting the analysis code

◦Dr. Kraft's code AST, codeDOM and Tokenization's are

woven tightly together

Porting Clone Analysis

22

Page 23: Cross Language Clone Analysis Team 2 November 10, 2010

Only does file-to-file comparisons◦ Does not detect clones in same source file

Can only detect Type 1 and some Type 2 clones

Not very efficient (brute force)

Limitations

23

Page 24: Cross Language Clone Analysis Team 2 November 10, 2010

Our User Interface

24

Page 25: Cross Language Clone Analysis Team 2 November 10, 2010

Unit TestingNUnit

25

Page 26: Cross Language Clone Analysis Team 2 November 10, 2010

White Box Testing: ◦ Unit Testing

Black Box Testing:◦ Production Rule Testing

Allows us to test the robustness of our engine because we can force rule production errors.

Regression Testing Automated

Two Types of Testing

26

Page 27: Cross Language Clone Analysis Team 2 November 10, 2010

What Is NUnit? NUnit is a unit-testing framework for all .Net

languages. Initially ported from JUnit, the current production release, version 2.5, is the sixth major release of this xUnit based unit testing tool for Microsoft .NET. It is written entirely in C# and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities.

http://www.nunit.org/index.php

NUnit

27

Page 28: Cross Language Clone Analysis Team 2 November 10, 2010

NUnit Example Code

28

Page 29: Cross Language Clone Analysis Team 2 November 10, 2010

NUnit Example Code

29

Page 30: Cross Language Clone Analysis Team 2 November 10, 2010

NUnit has approximately 180 unit test stubs created.

We are currently adding code to the unit test stubs that have functional code to support the test.

Unit testing demo

Unit Test Progress

30

Page 31: Cross Language Clone Analysis Team 2 November 10, 2010

Team CollaborationTeam 2 & Team 3

31

Page 32: Cross Language Clone Analysis Team 2 November 10, 2010

Team Collaboration Team 2 & Team 3 Both teams met Monday (11-8-10) after

class and performed the required Pair Programming.

Team 2◦ All project source code has been made available.◦ We are researching and working to update the

Java and C# grammars. Team 3

◦ Team 3 is working on C++ parsing. Looking into other parser, ELSA.

32

Page 33: Cross Language Clone Analysis Team 2 November 10, 2010

Patricia’s StatusPatricia Bradford

33

Page 34: Cross Language Clone Analysis Team 2 November 10, 2010

Beautiful baby boy, Joshua Aydan.

Patricia Had A….

34

Page 35: Cross Language Clone Analysis Team 2 November 10, 2010

Path ForwardNext Iteration & Schedule

35

Page 36: Cross Language Clone Analysis Team 2 November 10, 2010

Finalize Iteration 1Task (C++ to CodeDom) Continue Iteration 2 Task (Code Analysis) Continue Iteration 3 Task (Begin GUI)

Path Forward

36

Page 37: Cross Language Clone Analysis Team 2 November 10, 2010

Schedule

37