Table of Contents
Fetching ...

Diagnosing Refactoring Dangers

Wouter Brinksma, William Wernsen, Evert Verduin, Herman Hilberink, Patrick de Beer, Lex Bijlsma, Harrie Passier

TL;DR

A conceptual model to detect refactoring dangers, and an Eclipse plugin based upon this model, called ReFD, which evaluates a given code context to identify if potential risks are present, making them actual risks, and employs a verdict mechanism to reduce false positives.

Abstract

This report investigates the relationship between software refactoring and behavior preservation. Existing behavior preservation analyses often lack comprehensive insights into refactoring rejections and do not provide actionable solutions. To address these issues, we developed a conceptual model to detect refactoring dangers, and created an Eclipse plugin based upon this model, called ReFD. Every refactoring can be partitioned in microsteps, each of which carries potential risks. ReFD evaluates a given code context to identify if these potential risks are present, making them actual risks, and employs a verdict mechanism to reduce false positives. To facilitate the risk detection, several components called detectors and subdetectors are defined, which can be reused for multiple refactorings. The tool was validated by implementing the detection for multiple refactorings, which produce the expected information about the risks detected. This information leads a developer to actively think about solutions to the problems a refactoring might cause within an actual codebase.

Diagnosing Refactoring Dangers

TL;DR

A conceptual model to detect refactoring dangers, and an Eclipse plugin based upon this model, called ReFD, which evaluates a given code context to identify if potential risks are present, making them actual risks, and employs a verdict mechanism to reduce false positives.

Abstract

This report investigates the relationship between software refactoring and behavior preservation. Existing behavior preservation analyses often lack comprehensive insights into refactoring rejections and do not provide actionable solutions. To address these issues, we developed a conceptual model to detect refactoring dangers, and created an Eclipse plugin based upon this model, called ReFD. Every refactoring can be partitioned in microsteps, each of which carries potential risks. ReFD evaluates a given code context to identify if these potential risks are present, making them actual risks, and employs a verdict mechanism to reduce false positives. To facilitate the risk detection, several components called detectors and subdetectors are defined, which can be reused for multiple refactorings. The tool was validated by implementing the detection for multiple refactorings, which produce the expected information about the risks detected. This information leads a developer to actively think about solutions to the problems a refactoring might cause within an actual codebase.

Paper Structure

This paper contains 26 sections, 19 figures, 4 tables.

Figures (19)

  • Figure 1: Example code for Move Method refactoring
  • Figure 2: Applied Move Method on code from Figure \ref{['ch:introduction fig:example_code_move_method']}
  • Figure 3: Class addition to code from Figure \ref{['ch:introduction fig:example_code_move_method']}
  • Figure 4: Type of risks in relation to contexts
  • Figure 5: Informal detector version
  • ...and 14 more figures

Theorems & Definitions (22)

  • Example 1.1
  • Example 1.2
  • Example 2.1
  • Example 2.2
  • Example 2.3
  • Example 2.4
  • Example 2.5
  • Example 2.6
  • Example 2.7
  • Example 2.8
  • ...and 12 more