Skip to main content
QUICK REVIEW

[Paper Review] JExtract: An Eclipse Plug-in for Recommending Automated Extract Method Refactorings

Danilo Silva, Ricardo Terra|arXiv (Cornell University)|Jun 19, 2015
Software Engineering ResearchComputer Science10 references11 citations
TL;DR

JExtract is an Eclipse plug-in that recommends automated Extract Method refactorings by identifying contiguous code fragments with low structural similarity to the rest of a method, using dependency-based scoring. It outperforms JDeodorant in recall and precision for detecting contiguous misplaced code, achieving up to 49.2% recall and 16.7% precision across evaluated systems.

ABSTRACT

Although Extract Method is a key refactoring for improving program comprehension, refactoring tools for such purpose are often underused. To address this shortcoming, we present JExtract, a recommendation system based on structural similarity that identifies Extract Method refactoring opportunities that are directly automated by IDE-based refactoring tools. Our evaluation suggests that JExtract is far more effective (w.r.t. recall and precision) to identify misplaced code in methods than JDeodorant, a state-of-the-art tool

Motivation & Objective

  • Address the underuse of automated Extract Method refactoring tools despite their importance in improving code comprehension and maintainability.
  • Reduce the manual effort developers spend identifying refactoring opportunities by automating detection and recommendation.
  • Improve the adoption of IDE-based refactoring tools through intelligent, automated recommendations integrated into the Eclipse environment.
  • Develop a recommendation system that prioritizes code fragments with high structural dissimilarity to the remainder of the method, signaling potential extraction candidates.
  • Evaluate the tool’s effectiveness against state-of-the-art tools like JDeodorant using real-world open-source systems.

Proposed method

  • Generates all possible Extract Method candidates by splitting methods into contiguous blocks of statements with linear control flow.
  • Applies a size threshold (minimum 3 statements) and refactoring engine preconditions to filter valid candidates.
  • Computes structural dependencies (variable, type, and package dependencies) for candidate fragments and the remainder of the method.
  • Scores candidates based on the inverse of structural similarity between the extracted fragment and the remaining statements, favoring low similarity.
  • Ranks candidates by their score and integrates the recommendations directly into the Eclipse IDE for one-click application.
  • Uses a heuristic inspired by Move Method recommendation, but adapted to extract method candidates by maximizing dissimilarity between fragment and remainder.

Experimental results

Research questions

  • RQ1How effective is JExtract in identifying Extract Method refactoring opportunities compared to existing tools like JDeodorant?
  • RQ2To what extent does structural dissimilarity between code fragments and the remainder of a method correlate with valid Extract Method candidates?
  • RQ3Can a dependency-based similarity scoring mechanism improve recall and precision in recommending Extract Method refactorings?
  • RQ4How does JExtract perform on real-world open-source systems in terms of recall and precision for contiguous code fragments?
  • RQ5What is the impact of using automated recommendations on the adoption of Extract Method refactoring in practice?

Key findings

  • JExtract achieved a recall of up to 49.2% and a precision of 16.7% across evaluated open-source systems, with overall recall at 25.0% and precision at 19.8%.
  • The tool outperformed JDeodorant in both recall and precision for identifying contiguous misplaced code fragments in methods.
  • The highest recall was observed in the Quartz 1.8.3 system (49.2%), while the lowest precision was recorded in Tomcat 7.0.2 (12.8%).
  • The evaluation showed that JExtract’s scoring mechanism effectively prioritized fragments with low structural similarity to the remainder of the method.
  • The tool’s recommendations were validated against an oracle that required exact matches, which explains the moderate precision values.
  • The results suggest that structural dissimilarity is a strong indicator for Extract Method refactoring opportunities, especially for contiguous code blocks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.