Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Classification.

Slides:



Advertisements
Similar presentations
CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
Advertisements

Function Point Measurement from Java Programs
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Preliminary.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Identifying Source.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Extraction of.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Extracting Code.
Memories of Bug Fixes Sunghun Kim, Kai Pan, and E. James Whitehead Jr., University of California, Santa Cruz Presented By Gleneesha Johnson CMSC 838P,
13/07/2015Dr Andy Brooks1 Fyrirlestrar 9 & 10 CCFinder: A Tool to Detect Clones “I can just copy these lines. That is the safest thing to do. The code.
Refactoring Support Tool: Cancer Yoshiki Higo Osaka University.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Automatic Categorization.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Measuring Copying.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Industrial Application.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Where Does This.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University CoxR: Open Source.
Software Engineering Lab, Osaka University Code Clone Analysis and Its Application Katsuro Inoue Osaka University.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ICSE 2003 Java.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Finding Similar.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Refactoring.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Criterion for.
Department of Computer Science, Graduate School of Information Science and Technology, Osaka University DCCFinder: A Very- Large Scale Code Clone Analysis.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Investigation.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A clone detection approach for a collection of similar.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University What Do Practitioners.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 ARIES: Refactoring.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Method to Detect License Inconsistencies for Large-
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Code-Clone Analysis.
2002/12/11PROFES20021 On software maintenance process improvement based on code clone analysis Yoshiki Higo* , Yasushi Ueda* , Toshihiro Kamiya** , Shinji.
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 10.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Detection and evolution analysis of code clones for.
CMCD: Count Matrix based Code Clone Detection Yang Yuan and Yao Guo Key Laboratory of High-Confidence Software Technologies (Ministry of Education) Peking.
1 Gemini: Maintenance Support Environment Based on Code Clone Analysis *Graduate School of Engineering Science, Osaka Univ. **PRESTO, Japan Science and.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Design and Implementation.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Applying Clone.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Inoue Laboratory Eunjong Choi 1 Investigating Clone.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University How to extract.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University 1 Evaluation of a Business Application Framework Using Complexity.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Technology and Science, Osaka University Dependence-Cache.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Code-Clone Detection.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Development of.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Retrieving Similar Code Fragments based on Identifier.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Assertion with.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Investigation of Opportunities for Refactoring.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University July 21, 2008WODA.
Copyright © 2015 NTT DATA Corporation Kazuo Kobori, NTT DATA Corporation Makoto Matsushita, Osaka University Katsuro Inoue, Osaka University SANER2015.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Finding Code Clones.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Code Clone Analysis.
1 Measuring Similarity of Large Software System Based on Source Code Correspondence Tetsuo Yamamoto*, Makoto Matsushita**, Toshihiro Kamiya***, Katsuro.
1 Overview of Component Search System SPARS-J Tetsuo Yamamoto*,Makoto Matsushita**, Katsuro Inoue** *Japan Science and Technology Agency **Osaka University.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Extraction of.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Extracting Sequence.
What kind of and how clones are refactored? A case study of three OSS projects WRT2012 June 1, Eunjong Choi†, Norihiro Yoshida‡, Katsuro Inoue†
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 コードクローン解析に基づくリファクタリング支援.
Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Towards a Collection of Refactoring Patterns Based.
1 Gemini: Code Clone Analysis Tool †Graduate School of Engineering Science, Osaka Univ., Japan ‡ Graduate School of Information Science and Technology,
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Aries: Refactoring.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Detection of License Inconsistencies in Free and.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Metric-based Approach for Reconstructing Methods.
Estimating Code Size After a Complete Code-Clone Merge Buford Edwards III, Yuhao Wu, Makoto Matsushita, Katsuro Inoue 1 Graduate School of Information.
A Pluggable Tool for Measuring Software Metrics from Source Code
○Yuichi Semura1, Norihiro Yoshida2, Eunjong Choi3, Katsuro Inoue1
Predicting Fault-Prone Modules Based on Metrics Transitions
Refactoring Support Tool: Cancer
Quaid-i-Azam University
Yuhao Wu1, Yuki Manabe2, Daniel M. German3, Katsuro Inoue1
Multilingual Detection of Code Clones Using ANTLR Grammar Definitions
Java for Beginners University Greenwich Computing At School DASCO
On Refactoring Support Based on Code Clone Dependency Relation
Research Activities of Software Engineering Lab in Osaka University
Presentation transcript:

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Classification of Java Programs in SPARS-J Kazuo Kobori, Tetsuo Yamamoto, Makoto Matsusita and Katsuro Inoue Osaka University

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 2 Contents Background SPARS-J Reuse Similarity measurement techniques Characteristic metrics method Inclusive relation method Examples of its application Summaries and Future Works

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 3 Background SPARS-J is the web-based search engine for support of Software Reuse (for Java) A lot of parts are managed in this system source codes from open-source projects and public access files repository which stores 130,000 classes Components are classified by functions. In order to evaluate use-relation of every function Similar components may have the same functions Measurement of similarity between Components is needed.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 4 Reuse Similar components are made by Reuse Reuse is roughly divided into following two: 1.Reused as it is. Components are copied and used as it is. Some elements may be changed. 2.Reused by changing code. Components are copied and used with additional codes. Some methods and some variables are mainly added.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 5 Similarity measurement technique Character string comparison has so far been used for similar comparison of programs the high analysis cost per one comparison Hugeness of the total number of times of comparison It is unsuitable for SPARS-J We need much lower cost method

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 6 Similarity measurement technique in SPARS-J Characteristic metrics method In order to grasp Reuse as it is Metrics show the constitution of a component Metric is integer Only comparison of metrics is used for a similarity measurement reduction of calculation cost Inclusive relation method In order to grasp Reuse by minor change By using the code clone information between components, we analyze inclusive relation It has a scalability which can bear practical analysis. Analysis against millions of lines in practical time.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 7 Characteristic Metrics Characteristic metrics is measured from two viewpoints. Complexity number of methods, cyclomatic number, and etc. It shows a structural characteristic. Token-composition number of appearances of each token. Token = Reserved + Symbol + Operator + Identifier ( 96 types ) ( 49 ) ( 9 ) ( 37 ) (1) It shows a surface characteristic.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 8 Extraction of Characteristic Metrics TokenValue int void identifer T total Complexity value N of Cyclomatic N of method N of interface public class sample { int a, b, s ; char c ; public void main ( ) { c = ‘ m ’ ; if ( c = = ‘ m ’ ) { s = sum ( a, b ) ; } else { s = a + b; } public void sum ( int p, int q ) { return ( p + q ) ; } 2

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 9 Extraction of Characteristic Metrics TokenValue int void identifer T total Complexity value N of Cyclomatic N of method N of interface Complexity metrics public class sample { int a, b, s ; char c ; public void main ( ) { c = ‘ m ’ ; if ( c = = ‘ m ’ ) { s = sum ( a, b ) ; } else { s = a + b; } public void sum ( int p, int q ) { return ( p + q ) ; }

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 10 Extraction of Characteristic Metrics TokenValue int void identifer T total Complexity value N of Cyclomatic N of method N of interface Token composition metrics Complexity metrics public class sample { int a, b, s ; char c ; public void main ( ) { c = ‘ m ’ ; if ( c = = ‘ m ’ ) { s = sum ( a, b ) ; } else { s = a + b; } public void sum ( int p, int q ) { return ( p + q ) ; }

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 11 Judge Condition -1- Step1: We set thresholds of each complexity metrics Metricthreshold N of Cyclomatic0 N of methods1 N of method calls2 Nesting depth1 N of classes0 N of interfaces0

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 12 Judge Condition -1- We make hash key by Complexity metrics We make Hash Table in which Hash Key corresponds to components DB [ ]= null [ ]= Cp.A [ ]= Cp.B , Cp.C [ ]= null [ ]= Cp.Z ・ ・ ・ ・ ・ ・ 8bit metric A Hash Key (24bit) = If we judge new component P Hash Key of Cp.P = [ ] Thresholds of metric[A,B,C] = [0.0.1] [ ] [ ] We search these 3 keys [ ] metric B metric C We now similarity components down to Component A, B and C.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 13 Judge Condition -2- Component A B int void identifer T total ■ D(A,B): Non-similarity between Component A and B D ( A,B ) diff( A,B ) min(T total ( A ), T total ( B ) ) < threshold The sum of the difference of TCM Step2 : Components are judged by characteristic metrics Token Composition Metrics

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 14 Pattern of Reuse 1.Reused as it is. It can be extracted by judging similar components. 2.Reused by changing code. It can be extracted not by judging similar components, but by detecting inclusive relation.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 15 Pattern of Reuse 1.Reused as it is. It can be extracted by judging similar components. 2.Reused by changing code. It can be extracted not by judging similar components, but by detecting inclusive relations.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 16 Inclusive relation In characteristic metrics method One component contains another component completely. However, If the difference of size is more than the threshold. In this case, these two components can’t be judged to be similar.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 17 Inclusive relation method In order to grasp reuse with code addition By using the code clone information between components, we analyze inclusive relation Use of a code clone detection tool : 「 CCFinder 」 * It has a scalability which can bear practical analysis. –Analysis against millions of lines in practical time. *Toshihiro Kamiya, Shinji Kusumoto, and Katsuro Inoue, "CCFinder: A Multi-Linguistic Token- based Code Clone Detection System for Large Scale Source Code," IEEE Trans. Software Engineering, vol. 28, no. 7, pp , (2002-7).

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 18 The Inclusive Relations in Software Components x⊆yx⊆y ⇔ LOC(x)× Δ ≦ Cy(x) Δ←threshold About Component x: Total Line of Codes of x = LOC(x) The Number of Lines of x which is also contained in component y as a code clone = Cy(x)

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 19 Step 1: Code clone pair information is calculated through analysis of CCFinder. CCFinder Clone pair information components The Extraction Method of Inclusive Relation -1-

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 20 Step2: For each component X, check this formula Code Clone Component XComponent Y over Threshold ? X⊆YX⊆Y yes The Extraction Method of Inclusive Relation -2- x⊆yx⊆y ⇔ LOC(x)× Δ ≦ Cy(x)

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 21 Step 3 : By comparing metrics, this judges whether the extracted pair is an inclusive relation. ■Cp.X ⊆ Cp.Y metricCp.XCp.Y int void identifer T total < < < < < The Extraction Method of Inclusive Relation -3-

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 22 Application Result Characteristic metrics method We show the cost scale figure Inclusive relation method We show some examples which are in inclusive relation

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 23 Application Result -1- ■ calculation time of Characteristic Metrics Method Number of Components sec ※ calculation time of characteristic string method = 24.3 sec (at 500 components)

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 24 Application Result -2- PipedInputStream PipedReader Code Clone ■ Example of a extracted inclusive relation ⊆ void receive( ) int read( ) void close() void connect() void receive( ) int read( ) void close() void connect() int available( ) LOC: 142 LOC: 131

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 25 Application Result -2- FilePermmission PropertyPermission SocketPermission FormatNumberFormat ■other Examples of a extracted inclusive relation ⊆ ⊆ LOC:207LOC:25 LOC:457 LOC:249 LOC:135

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 26 Summary And Future Work Summary We have suggested similarity measurements Characteristic metrics method Inclusive relations method Future Work Evaluation of system performance Adjustment of a threshold