Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 ARIES: Refactoring."— Presentation transcript:

1 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 ARIES: Refactoring Support Tool for Code Clone Yoshiki Higo 1, Toshihiro Kamiya 2, Shinji Kusumoto 1, Katsuro Inoue 1 1 Osaka University 2 National Institute of Advanced Industrial Science and Technology {y-higo, kamiya, kusumoto, inoue}@ist.osaka-u.ac.jp

2 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 2 Contents Background Proposed Refactoring Support Method Step1, Step2, Step3 Metrics used in Step3 Refactoring Support Tool Aries Case Study Overview Filtering Conditions Evaluation Method Result Conclusion

3 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 3 Background What is code clone? a code fragment that has identical or similar fragments in the same or different files in a system introduced in the source program because of various reasons such as reusing code by `copy-and-paste’ makes software maintenance more difficult. copy-and-paste

4 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 4 Contents Background Proposed Refactoring Support Method Step1, Step2, Step3 Metrics used in Step3 Refactoring Support Tool Aries Case Study Overview Filtering Conditions Evaluation Method Result Conclusion

5 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 5 Our Refactoring Support Method for Code Clone We have proposed a refactoring support method for code clone We adopt three steps to get refactoring-oriented code clones quickly First Step: Run CCFinder to get token-based code clones Second Step: Extract structural parts from code clones detected by CCFinder Final Step: Characterize extracted code clones to predict how they can be refactored We have implemented our method as a tool Aries In this presentation, we explain about our method and report the result of a case study using Aries

6 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 6 Our Refactoring Support Method: First Step: CCFinder (Outline) CCFinder directly compares source code on token unit, and detects code clones Normalization of name space Replacement of names defined by user Removal of table initialization Consideration of module delimiter CCFinder can analyze the system of millions line scale in practical use time

7 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 7 Source files Lexical analysis Transformation Token sequence Match detection Transformed token sequence Clones on transformed sequence Formatting Clone pairs 1. static void foo() throws RESyntaxException { 2. String a[] = new String [] { "123,400", "abc", "orange 100" }; 3. org.apache.regexp.RE pat = new org.apache.regexp.RE("[0-9,]+"); 4. int sum = 0; 5. for (int i = 0; i < a.length; ++i) 6. if (pat.match(a[i])) 7. sum += Sample.parseNumber(pat.getParen(0)); 8. System.out.println("sum = " + sum); 9. } 10. static void goo(String [] a) throws RESyntaxException { 11. RE exp = new RE("[0-9,]+"); 12. int sum = 0; 13. for (int i = 0; i < a.length; ++i) 14. if (exp.match(a[i])) 15. sum += parseNumber(exp.getParen(0)); 16. System.out.println("sum = " + sum); 17. } Lexical analysis Transformation Token sequence Match detection Transformed token sequence Clones on transformed sequence Formatting Lexical analysis Transformation Token sequence Match detection Transformed token sequence Clones on transformed sequence Formatting 1. static void foo() throws RESyntaxException { 2. String a[] = new String [] { "123,400", "abc", "orange 100" }; 3. org.apache.regexp.RE pat = new org.apache.regexp.RE("[0-9,]+"); 4. int sum = 0; 5. for (int i = 0; i < a.length; ++i) 6. if (pat.match(a[i])) 7. sum += Sample.parseNumber(pat.getParen(0)); 8. System.out.println("sum = " + sum); 9. } 10. static void goo(String [] a) throws RESyntaxException { 11. RE exp = new RE("[0-9,]+"); 12. int sum = 0; 13. for (int i = 0; i < a.length; ++i) 14. if (exp.match(a[i])) 15. sum += parseNumber(exp.getParen(0)); 16. System.out.println("sum = " + sum); 17. } Lexical analysis Transformation Token sequence Match detection Transformed token sequence Clones on transformed sequence Formatting Our Refactoring Support Method: First Step: CCFinder (Clone Detection Process)

8 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 8 Definitions: Clone Pair and Clone Set Clone Pair: a pair of identical or similar fragments Clone Set: a set of identical or similar fragments CCFinder detects code clones as clone pairs After detection process, clone pairs are transformed into clone sets C1 C5 C4 C3 C2 Clone PairClone Set (C1, C4){C1, C4, C5} (C1, C5){C2, C3} (C2, C3) (C4, C5)

9 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 9 Our Refactoring Support Method: Second Step: Extract Structural Code Clones Structural code clones are regarded as the target of refactoring Extract structural parts as structural code clones from the detected clone sets What is structural code clone ? example: Java language Declaration: class declaration, interface declaration Method: method body, constructor, static initializer Statement: do, for, if, switch, synchronized, try, while

10 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 10 609: reset(); 610: grammar = g; 611: // Lookup make-switch threshold in the grammar generic options 612: if (grammar.hasOption("codeGenMakeSwitchThreshold")) { 613: try { 614: makeSwitchThreshold = grammar.getIntegerOption("codeGenMakeSwitchThreshold"); 615: //System.out.println("setting codeGenMakeSwitchThreshold to " + makeSwitchThreshold); 616: } catch (NumberFormatException e) { 617: tool.error( 618: "option 'codeGenMakeSwitchThreshold' must be an integer", 619: grammar.getClassName(), 620: grammar.getOption("codeGenMakeSwitchThreshold").getLine() 621: ); 622: } 623: } 624: 625: // Lookup bitset-test threshold in the grammar generic options 626: if (grammar.hasOption("codeGenBitsetTestThreshold")) { 627: try { 628: bitsetTestThreshold = grammar.getIntegerOption("codeGenBitsetTestThreshold"); 623: } 624: 625: // Lookup bitset-test threshold in the grammar generic options 626: if (grammar.hasOption("codeGenBitsetTestThreshold")) { 627: try { 628: bitsetTestThreshold = grammar.getIntegerOption("codeGenBitsetTestThreshold"); 629: //System.out.println("setting codeGenBitsetTestThreshold to " + bitsetTestThreshold); 630: } catch (NumberFormatException e) { 631: tool.error( 632: "option 'codeGenBitsetTestThreshold' must be an integer", 633: grammar.getClassName(), 634: grammar.getOption("codeGenBitsetTestThreshold").getLine() 635: ); 636: } 637: } 638: 639: // Lookup debug code-gen in the grammar generic options 640: if (grammar.hasOption("codeGenDebug")) { 641: Token t = grammar.getOption("codeGenDebug"); 642: if (t.getText().equals("true")) { fragment 1fragment 2 Code clones which CCFinder detects Code clones which our method detects

11 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 11 1007: if ( inputState.guessing==0 ) { 1008: buf.append(a.getText()); 1009: } 1010: { 1011: _loop144: 1012: do { 1013: if ((LA(1)==WILDCARD)) { 1014: match(WILDCARD); 1015: a=id(); 1016: if ( inputState.guessing==0 ) { 1017: buf.append('.'); buf.append(a.getText()); 1018: } 1019: } 1527: if ( inputState.guessing==0 ) { 1528: t=a.getText(); 1529: } 1530: { 1531: _loop84: 1532: do { 1533: if ((LA(1)==COMMA)) { 1534: match(COMMA); 1535: id(); 1536: if ( inputState.guessing==0 ) { 1537: t+=","+b.getText(); 1538: } 1539: } Code clones which CCFinder detects

12 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 12 Our Refactoring Support Method: Final Step: Characterize Extracted Code Clones The following refactoring patterns[1][2] can be applied to remove clone sets including structural code clones Extract Class, Extract Method, Extract Super Class, Form Template Method, Move Method, Parameterize Method, Pull Up Constructor, Pull Up Method, For each clone set, our method determines which refactoring pattern is applicable by using several metrics. [1]: M. Fowler: Refactoring: Improving the Design of Existing Code, Addison-Wesley, 1999. [2]: http://www.refactoring.com/, 2004.http://www.refactoring.com/

13 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 13 Metrics(1): Coupling Metrics for Clone Set NRV, NSV NRV(S): represents the average number of externally defined variables referred in the fragment of a clone set S NSV(S): represents the average number of externally defined variables assigned to in the fragment of a clone set S Definition Clone set S includes fragment f 1, f 2, ・・・, f n s i is the number of externally defined variable which fragment f i refers t i is the number of externally defined variable which fragment f i assigns int a, b, c; … if( … ){ … ; … = b + c; a = … ; … ; } … assignment reference Fragment f 1 example : ・ Clone set S includes fragments f 1 and f 2. ・ In fragment f 1, externally defined variable b and c are referred and a is assigned to. ・ Fragment f 2 is same as f 1. then , NRV(S) = ( 2 + 2 ) / 2 = 2 NSV(S) = ( 1 + 1 ) / 2 = 1 int a, b, c; … if( … ){ … ; … = b + c; a = … ; … ; } … Fragment f 2 reference assignment

14 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 14 Metrics ( 2 ): Inheritance Metric for Clone Set DCH DCH(S): represents the position and distance between each fragment of a clone set S Definition Clone set S includes fragment f 1, f 2, ・・・, f n Fragment f i exists in class C i Class C p is a class which locates lowest position in C 1, C 2, ・・・, C n on class hierarchy If no common parent class of C 1 , C 2 ,・・・, C n exists, the value of DCH(S) is -1 This metric is measured for only the class hierarchy where target software exists. example 1: ・ Clone set S includes fragments f 1 and f 2. ・ If all fragments of clone set S are included in a same class, then , DCH(S) = 0 class A fragment f 1 fragment f 2 class A class B class C fragment f 1 fragment f 2 example 2 : ・ Clone set S includes fragments f 1 and f 2. ・ If all fragments of clone set S are included in a class and its direct child classes, then , DCH(S) = 1 fragment f 1 fragment f 2 class A class B example 3 : ・ Clone set S includes fragments f 1 and f 2. ・ If all classes which include f 1 and f 2 don ’ t have common parent class, then , DCH(S) = ∞

15 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 15 Aries: Refactoring Support Tool Overview Target: Java programs Runtime environment: JDK1.4 or above Implementation Analysis component: Java 32,000 Lines CCFinder is used as code clone detection component JavaCC is used to construct syntax and semantic analysis component GUI component: Java14,000 Lines User can specify target clone sets through GUI operations.

16 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 16 Contents Background Proposed Refactoring Support Method Step1, Step2, Step3 Metrics used in Step3 Refactoring Support Tool Aries Case Study Overview Filtering Conditions Evaluation Method Result Conclusion

17 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 17 Case Study: Overview Business application developed by a software company in Japan Size LOC: 70,000 Number of classes: 309 Process of case study Step1: Extract clone set which can be refactored using the following refactoring patterns Extract Super Class Move Method Extract Method Step2: Qualitatively evaluate the results of the refactorings by a developer from the viewpoint of size, design, cohesion, coupling, understandability, and reusability

18 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 18 Case Study: Filtering Conditions(1/3) Conditions for “Extract Super Class” The target is Class-Unit clone sets Cloned Classes have no parent Department Employee getTotalAnnualCost() getName() getHeadCount() getAnnualCost() getName() getId() Before Refactoring Employee getTotalAnnualCost() getHeadCount() Department getTotalAnnualCost() getHeadCount() Party getAnnualCost() getName() After Refactoring Similar classes

19 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 19 Case Study: Filtering Conditions(1/3) Conditions for “Move Method” The target is Method-Body-Unit clone sets Cloned methods use no other resource of its class ClassA Before Refactoring ClassB ClassC ClassD clonedMethod() ClassA After Refactoring ClassB ClassC ClassD UtilityClass clonedMethod()

20 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 20 Case Study: Filtering Conditions(1/3) Conditions for “Extract Method” The target is Statement-Unit clone sets such as “if”, “while”, “for” … Cloned statements assign any value to 1 or no externally defined variable All statements of a clone set are in a same class void methodA(int i){ methodZ(); System.out.println( “ name: ” + name); System.out.println( “ amount: ” + i); } void methodB(int i){ methodY(); System.out.println( “ name: ” + name); System.out.println( “ amount: ” + i); } void methodA(int i){ methodZ(); methodC(i); } void methodB(int i){ methodY(); methodC(i); } void methodC(int i){ System.out.println( “ name: ” + name); System.out.println( “ amount: ” + i); } Before RefactoringAfter Refactoring

21 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 21 Case Study: Result of Filtering Number of detected clone set Declaration Unit: 4 Method Unit: 13 Statement Unit: 49 Number of filtered clone set Extract Super Class: 4 Move Method: 5 Extract Method: 12

22 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 22 Case Study: Evaluation Method(1/3) A developer of the target system evaluated refactorings of filtered clone sets from the following viewpoints About status of clones (He judged each following term of the status on a scale of (a) or (b)) size of module design of software cohesion of class coupling among classes (a) deteriorating, (b) making no impact

23 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 23 Case Study: Evaluation Method(2/3) The continuation About effectiveness of refactorings (He judged each following term of the effectiveness on a scale from (a) to (d) ) size design cohesion coupling understandability reusability (a) improving , (b) preventing problems for the future , (c) having no impact , (d) deteriorating

24 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 24 Case Study: Evaluation Method(3/3) The continuation About costs of refactorings (He judges two terms of the cost on a scale from (a) to (c)) modifying source code testing for regression (a) very easy, (b) a little troublesome , (c) complicated Comprehensive Evaluation ( He judged the comprehensive evaluation on a scale from (a) to (d)) This clone set … (a) must be refactored as soon as possible (b) should be refactored for the future (c) is no matter about refactoring (d) should not be refactored

25 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 25 The status of “Declaration-Unit” clones All clone sets deteriorate size and design All clone sets have no impact on cohesion, and coupling Case Study: The Result - Extract Super Class ( 1/4 ) (a)(b)Total Size404 Design404 Cohesion044 Coupling044 (a)Deteriorating (b)Making no Impact

26 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 26 The effectiveness of “Declaration-Unit” refactorings Refactorings of all clone sets are effective in terms of size, design, understandability, and reusability Refactorings of all clone sets have no impact in terms of cohesion, and coupling Case Study: The Result - Extract Super Class ( 2/4 ) (a)(b)(c)(d)Total Size22004 Design22004 Cohesion00404 Coupling00404 Understandabilit y 13004 Reusability13004 (a)Improving (b)Preventing problems for the future (c)Having no impact (d)Deteriorating

27 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 27 The cost of “Declaration-Unit” refactorings Modifying requires a little trouble Testing becomes complicated in some cases The comprehensive evaluation of “Declaration-Unit” refactoring All clone sets must or should be refactored Case Study: The Result - Extract Super Class ( 3/4 ) (a)(b)(c)Total Modifying1304 Testing1124 (a)(b)(c)(d)Total Refactoring … 22004 (a)Very Easy (b)A little Troublesome (c)Complicated (a)Must be refactored (b)Should be refactored (c)No matter (d)Shouldn ’ t be refactored

28 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 28 Case Study: The Result - Extract Super Class ( 4/4 ) AcceptHeadCheckerSakubanHeadChecker doStartTag() doAfterBody() doEndTag() doStartTag() doAfterBody() doEndTag() New Class doAfterBody() doEndTag() AcceptHeadCheckerSakubanHeadChecker doStartTag() Before RefactoringAfter Refactoring Methods “DoAfterBody” and “DoEndTag” are exactly identical respectively Methods “DoStartTag” provides different functions

29 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 29 The status of “Method-Unit” clones All clone sets deteriorate size and design Most of them(80%) deteriorate cohesion All clone sets have no impact on coupling Case Study: The Result - Move Method ( 1/4 ) (a)(b)Total Size505 Design505 Cohesion415 Coupling055 (a)Deteriorating (b)Making no Impact

30 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 30 The effectiveness of “Method-Unit” refactorings Refactorings of all clone sets are effective in terms of size, design, cohesion, understandability, and reusability Refactorings of all clone sets have no impact on coupling Case Study: The Result - Move Method ( 2/4 ) (a)(b)(c)(d)Total Size50005 Design50005 Cohesion50005 Coupling00505 Understandabilit y 41005 Reusability41005 (a)Improving (b)Preventing problems for the future (c)Having no impact (d)Deteriorating

31 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 31 The cost of “Method-Unit” refactorings Both modifying and testing are very easy The comprehensive evaluation of “Method-Unit” refactorings All clone sets must or should be refactored Case Study: The Result - Move Method ( 3/4 ) (a)(b)(c)Total Modifyin g 5005 Testing5005 (a)(b)(c )(d)Total Refactoring …41005 (a)Very Easy (b)A little Troublesome (c)Complicated (a)Must be refactored (b)Should be refactored (c)No matter (d)Shouldn ’ t be refactored

32 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 32 Case Study: The Result - Move Method ( 4/4 ) The following method exist in 9 classes This method converts ResultData to HashMap This method uses no other fields or methods of its class Moving to other class is very easy The developer judged that this refactoring is effective private HashMap convertToMap(ResultData rd){ String[] names = rd.getNames(); HashMap map = new HashMap(); for( int i = names.length ; i++ ){ map.put([i], rd.getObject(names[i])); } return map; }

33 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 33 The status of “Statement-Unit” clones Part of clone sets deteriorates size and design All clone sets have no impact on cohesion, and coupling Case Study: The Result - Extract Method ( 1/4 ) (a)(b)Total Size21012 Design21012 Cohesion012 Coupling012 (a)Deteriorating (b)Making no Impact

34 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 34 The effectiveness of “Statement-Unit” refactorings The effectiveness of refactorings is divisive in terms of size, design, understandability, and reusability Refactorings of all clone set have no impact on cohesion, and coupling Case Study: The Result - Extract Method ( 2/4 ) (a)(b)(c)(d)Total Size054312 Design033612 Cohesion00120 Coupling00120 Understandabilit y 043512 Reusability224412 (a)Improving (b)Preventing problems for the future (c)Having no impact (d)Deteriorating

35 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 35 The cost of “Statement-Unit” refactorings Almost half of clone sets require a lot of cost on both modifying and testing The comprehensive evaluation of “Statement-Unit” refactorings Almost half of clone sets shouldn’t be refactored Case Study: The Result - Extract Method ( 3/4 ) (a)(b)(c)Total Modifyin g 35412 Testing26412 (a)(b)(c)(d)Total Refactoring … 033612 (a)Very Easy (b)A little Troublesome (c)Complicated (a)Must be refactored (b)Should be refactored (c)No matter (d)Shouldn ’ t be refactored

36 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 36 Case Study: The Result - Extract Method ( 4/4 ) The following if-statement appeared 5 times in a class Red variables mean that they are defined outside this if-statement They must be added to the argument of the extracted method. This statement can be extracted as a new method in the same class, but … The argument of the new method become long. Extracting 5 times requires a lot of cost. if( vomrgpersonSyuningishi.getName() != null && !vomrgpersonSyuningishi.getName().equals( “” )) { checkOwnSettlement(vomrgpersonSyuningishi.getShimeiNo(), vomrgpersonSyuningishi.getName(), vomanager, voprojectinfo, vodocumentinfo, vomrgpersonSyunigishi.getBusyomei()); }

37 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 37 Some “Statement-Unit” clones were judged as not suited to be refactored Extracting manually a part of a method is complicated Making the filtering conditions stricter Helping modification working Some clone sets depend on the framework used in the system The following table represents the ratio of refactorings judged as effective ((a) improving, or (b) preventing problems for the future) Case Study: Discussions Extract Super Class Move Method Extract Method Size4/4 (100%)5/5 (100%)5/12 ( 42%) Design4/4 (100%)5/5 (100%)3/12 ( 25%) Cohesion0/4 ( 0%)5/5 (100%)0/12 ( 0%) Coupling0/4 ( 0%)0/5 ( 0%)0/12 ( 0%) Understandability4/4 (100%)5/5 (100%)4/12 ( 33%) Reusability4/4 (100%)5/5 (100%)4/12 ( 33%) “Extract Super Class” and “Move Method” refactorings are effective Those clone sets deteriorate some software qualities Refactorings of them can improve qualities They don’t require much cost

38 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 38 Contents Background Proposed Refactoring Support Method Step1, Step2, Step3 Metrics used in Step3 Refactoring Support Tool Aries Case Study Overview Filtering Conditions Evaluation Method Result Conclusion & Future Works

39 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 39 Conclusion & Future works We have proposed refactoring support method implemented a refactoring support tool, Aries conducted a case study to a business application “Declaration-Unit” and “Method-Unit” refactorings are effective Some “Statement-Unit” clones are not appropriate to be refactored As future works, we are going to evaluate refactoring effectiveness quantitatively add an effectiveness measurement function to Aries for comprehensive supporting refactoring of code clones

40 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 40

41 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 41 Code clone detection for refactoring: Related Works Detect similar sub-graphs as clone on program dependency graph [1]. High accuracy: This approach finds out data-dependence and control dependence in source codes. High time complexity: It takes O(n 2 ) time to construct program dependency graph. Detect similar methods and functions as clone using metrics [2]. Low accuracy: if the size of target method or function is small, the values of metric make no difference. detection unit restriction: only method and function unit clone can be detected. [1] R. Komondoor and S. Horwitz, “ Using slicing to identify duplication in source code ”, In Proc. of the 8th International Symposium on Static Analysis, Paris, France, July 16-18, 2001. [2] Magdalena Balazinska, Ettore Merlo, Michel Dagenais, Bruno Lague, and Lostas Kontogiannis, “Advanced Clone-Analysis to Support Object-Oriented System Refactoring”, WCRE 2000, pp. 98-107

42 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 42 Properties Size: means the number of lines or token of modules Design: means the structure of hierarchy of classes or encapsulation of classes Cohesion: means the responsibility of classes. If a classes provide no or various functions, the cohesion of the class becomes wrong (low) Coupling: means usage of fields or method of other classes. If fields or methods are defined in an inappropriate class, the coupling becomes wrong (high)


Download ppt "Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 ARIES: Refactoring."

Similar presentations


Ads by Google