1 / 6

Towards a Collection of Refactoring Patterns Based on Code Clone Categorization

Towards a Collection of Refactoring Patterns Based on Code Clone Categorization. Masayuki Tokunaga † , Norihiro Yoshida † † , Kazuki Yoshioka † , Makoto Matsushita † , Katsuro Inoue † † : Osaka university ††: Nara Institute of Science and Technology. Research Background (1/2).

mimi
Download Presentation

Towards a Collection of Refactoring Patterns Based on Code Clone Categorization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Towards a Collection of Refactoring Patterns Based on Code Clone Categorization Masayuki Tokunaga†, Norihiro Yoshida † †, Kazuki Yoshioka †, Makoto Matsushita †, Katsuro Inoue † †: Osaka university ††: Nara Institute of Science and Technology

  2. Research Background (1/2) code clone copy-and-paste • What is Code Clone ? • Code fragments in a source code that are identical or similar to each other • Created by copy-and-paste • Makes software maintenance more difficult • Merged into one module though refactoring

  3. Research Background (2/2) • [1]Martin Fowler, “Refactoring Improving the design of existing code” • What is refactoring pattern? • Pattern of the refactoring process • Decrease the efforts of refactoring • Can be applied to the experimental modification • Typical refactoring pattern • Fowler’s Pattern[1] • Categorize code clone characteristics into five categories • Propose processes of refactoring for each code clone category

  4. Probrem(1/2) • Pattern • Extract method • Categories of code clone characteristics • clone in the same classes • Pattern • Extract method • Categories of code clone characteristics • clone in the same classes(+ having differences) uncategorized characteristics Clone Pair Clone Pair void printOwing(double amount){ printButton(); System.out.print(_name); System.out.print(amount); } void printOwing(double amount){ printButton(); System.out.print(_name); System.out.print(amoujnt); } void printAssets(double amount){ printBanner(); System.out.print(_name); System.out.print(amount); } void printAssets(double amount){ printBanner(); System.out.print(_name); System.out.print(amount+100); } difference according to detailed processes related in clone characteristics according to process in the proposed pattern void printOwing(double amount){ printButton(); printDetail(amount); } void printAssets(double amount){ printBanner(); printDetail(amount); } Easy for beginner void printDetail(double amount){ System.out.print(name); System.out.print(amount); } void printDetail(double amount){ System.out.print(name); System.out.print(amount); } Can’t apply Need an additional work by developer’s decision

  5. Problem(2/2) Detailed categorization of clone characteristics → Help beginner by decreasing uncertain processes • There are uncategorized clones in detail on existing patterns • It is difficult to apply the refactoring pattern for beginners by necessity of developer’s additional work

  6. Our Research Define categorization Auto-add categorization information Create of patterns Detected Clones • Creating refactoring patterns based on the detailed categorization of clone characteristics

More Related