Eclipse A Tool Support to Merge Similer Methods with Differences Akira Goto 1 Norihiro Yoshida 2 Masakazu Ioka 1 Katsuro Inoue 1 Abstra

Similar documents
1,a) 1,b) TUBSTAP TUBSTAP Offering New Benchmark Maps for Turn Based Strategy Game Tomihiro Kimura 1,a) Kokolo Ikeda 1,b) Abstract: Tsume-shogi and Ts

1.










Fig. 3 3 Types considered when detecting pattern violations 9)12) 8)9) 2 5 methodx close C Java C Java 3 Java 1 JDT Core 7) ) S P S




IPSJ SIG Technical Report Secret Tap Secret Tap Secret Flick 1 An Examination of Icon-based User Authentication Method Using Flick Input for







モ ~b.




Vol.55 No (Jan. 2014) saccess 6 saccess 7 saccess 2. [3] p.33 * B (A) (B) (C) (D) (E) (F) *1 [3], [4] Web PDF a m

IPSJ SIG Technical Report Vol.2012-CG-148 No /8/29 3DCG 1,a) On rigid body animation taking into account the 3D computer graphics came





[?~ζ

(1) a. He has gone already. b. He hasn't gone yet. c. Has he gone yet?


29 jjencode JavaScript


ID 3) 9 4) 5) ID 2 ID 2 ID 2 Bluetooth ID 2 SRCid1 DSTid2 2 id1 id2 ID SRC DST SRC 2 2 ID 2 2 QR 6) 8) 6) QR QR QR QR





227 study




Vol.61 No.1 June 2011



135










The copyright of this material is retained by the Information Processing Society of Japan (IPSJ). The material has been made available on the website


Input image Initialize variables Loop for period of oscillation Update height map Make shade image Change property of image Output image Change time L




2






1_26.dvi

133





[2] OCR [3], [4] [5] [6] [4], [7] [8], [9] 1 [10] Fig. 1 Current arrangement and size of ruby. 2 Fig. 2 Typography combined with printing







文を綴る、文を作る















53

Transcription:

Title 差分を含む類似メソッドの集約支援ツール Author(s) Citation 後藤, 祥 ; 吉田, 則裕 ; 井岡, 正和 ; 井上, 克郎 ソフトウェアエンジニアリングシンポジウム 2012 論文集. 2012 P.1-P.6 Issue Date 2012-08-21 Text Version publisher URL http://hdl.handle.net/11094/50124 DOI rights ここに掲載した著作物の利用に関する注意本著作物の著作権は情報処理学会に帰属します 本著作物は著作権者である情報処理学会の許可のもとに掲載するものです ご利用に当たっては 著作権法 ならびに 情報処理学会倫理綱領 に従うことをお願いいたします

2012 1 2 1 1 1 Eclipse A Tool Support to Merge Similer Methods with Differences Akira Goto 1 Norihiro Yoshida 2 Masakazu Ioka 1 Katsuro Inoue 1 Abstract: A method that has identical or similar methods is called similar method. Merging similar methods into a single method is often performed to improve the maintainability of a program. However, it is difficult for a developer to merge similar methods with differences. In this paper, we propose an approach that supports to merge similar methods with differences by showing candidates of merging similar methods. The proposed approach has been implemented as a plugin of Eclipse. In the case study, we applied the proposed approach to actual similar methods in open source projects. As a result, we confirmed useful candidates in the output of the proposed approach by the questionnaire. 1. [11] 2 [2] Template Method Template Method [2]Template Method 1 Osaka University 2 Nara Institute of Science and Technology 4 (2 2 ) 4 () ( 1) ( 1 1) (AST) ( 1 23) ( 1 4) ( 1 5) c 2012 Information Processing Society of Japan 1

2012 Fig. 1 1 Overview of the Proposed Approach Fig. 2 2 AST An Example of Indexing for Particular Nodes in AST AST 2 AST Eclipse 2. M A M B AST 2 1 ( ) 5 2.1 M A M B AST Eclipse JDT AST AST (Assginment Expression ) () AST AST 1 (ExpressionStatement) (Return- Statement) 2 2.2 AST AST 2 N A N B (1) N A N B N A N B AST N A N B N A N B N A N B Block (1) Block (2) (2) Block Block Block [1] AST 3 AST ( 3 ) c 2012 Information Processing Society of Japan 2

2012 Fig. 3 3 Detecting Statement-level Differences between Similar Methods 5 Fig. 5 Expansion for Code Fragments 4 Fig. 4 Merging Differences (2.3 ) 2 4 1 () i (i + 1) (i 1) 2 1 2 (Block ) Block Block M A M B ( A, B ) δ Ai A M A M B δ Bi B 2.3 ( A, B ) 2 M B M A A, B ( A = B = n) E A, E B ( E A = E B = m, 1 m n) A *1 B E A, E B E A, E B C e Ai, e Aj E A (i j) (E B ) D δ Ai A e Aj E A 1 ( B E B ) δ δ include(δ) include(δ) δ AST AST cf δ 5 1 () cf AST () i max i min (i max + 1) (i min 1) *1 [5] Figure.2 c 2012 Information Processing Society of Japan 3

2012 cf cf include(δ) cf cf 2 2 () cf AST cf cf include(δ) cf Method Declaration 1 A, B {include(δ A1 ), include(δ A2 ),, include(δ An )} {include(δ B1 ), include(δ B2 ),, include(δ Bn )} include(δ) len(e Ai ) len(m A ) > threshold, len(e Bi) len(m B ) > threshold len(x) x e Ai E A e Bi E B 1 3. Template Method [7] [6], [8] M len(m) M V M V i M V o M F SL x x BSL x x SL int V i V o F T ightness(m) = SL int len(m) F Coverage(M) = 1 V ( x V i F SL x len(m) + x V o BSL x len(m) ) F Overlap(M) = 1 V ( x V i SL int F SL x + x V o SL int BSL x ) 3 3 4. Eclipse 6 6 1 1 5. Ant ANTLR 2 1 *2 *2 Ant : executedrawoperation (Arc,Ellipse ) ANTLR : generrorhandler (CppCodeGenerator,JavaCodeGenerator ) c 2012 Information Processing Society of Japan 4

2012 6 Fig. 6 A Screenshot of the Tool 3 10 15 5.1 2 1 (ARSC) 2 (AP) [1] A P (A i ) A i AP = 1 A P (A i ) (1) A i=1 5.2 Ant 23 ANTLR 34 Ant 14 ANTLR 6 ANTLR 6 0.5 1 0.213 0.267 2 Ant 0.5 Ant ANTLR 1 3 1 3 1 Table 1 Result of the Questionnaire ARSC AP FTightness 0.253 0.533 Ant FCoverage 0.213 0.560 FOverlap 0.253 0.535 FTightness 0.267 0.438 ANTLR FCoverage 0.267 0.346 FOverlap 0.267 0.438 c 2012 Information Processing Society of Japan 5

2012 2 3 6. COB [9], [10] [9] Juillerat Template Method [4] Template Method Hotta [3]Hotta Template Method 1 7. 3 3 AST 1 A:21240002C) :22500026 [1] Baeza-Yates, R. and Ribeiro-Neto, B.: Modern Information Retrieval, Addison Wesley, second edition (2011). [2] Fowler, M.: Refactoring: Improving the Design of Existing Code, Addison Wesley (1999). [3] Hotta, K., Higo, Y. and Kusumoto, S.: Identifying, Tailoring, and Suggesting Form Template Method Refactoring Opportunities with Program Dependence Graph, Proc. of CSMR2012, pp. 53 62 (2012). [4] Juillerat, N. and Hirsbrunner, B.: Toward an Implementation of the Form Template Method Refactoring, Proc. of SCAM2007, pp. 81 90 (2007). [5] Murphy-hill, E. and Black, A. P.: Breaking the barriers to successful refactoring: observations and tools for extract method, Proc. of ICSE2008, pp. 421 430 (2008). [6] Ott, L. M. and Thuss, J. J.: Slice Based Metrics for Estimating Cohesion, Proc. of METRICS1993, pp. 71 81 (1993). [7] Stevens, W. P., Myers, G. J. and Constatine, L. L.: Structured design, IBM Syst.J, Vol. 13, No. 2, pp. 115 139 (1974). [8] Weiser, M.: Program slicing, Proc. of ICSE1981, pp. 439 449 (1981). [9] COB Template Method Vol. 111, No. 169, pp. 57 62 (2011). [10] XVIIpp. 125 130 (2010). [11] (D)Vol. J91-D, No. 6, pp. 1465 1481 (2008). 3 c 2012 Information Processing Society of Japan 6