Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
80 tokens/sec
GPT-4o
59 tokens/sec
Gemini 2.5 Pro Pro
43 tokens/sec
o3 Pro
7 tokens/sec
GPT-4.1 Pro
50 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Why We Refactor? Confessions of GitHub Contributors (1607.02459v1)

Published 8 Jul 2016 in cs.SE

Abstract: Refactoring is a widespread practice that helps developers to improve the maintainability and readability of their code. However, there is a limited number of studies empirically investigating the actual motivations behind specific refactoring operations applied by developers. To fill this gap, we monitored Java projects hosted on GitHub to detect recently applied refactorings, and asked the developers to ex- plain the reasons behind their decision to refactor the code. By applying thematic analysis on the collected responses, we compiled a catalogue of 44 distinct motivations for 12 well-known refactoring types. We found that refactoring activity is mainly driven by changes in the requirements and much less by code smells. Extract Method is the most versatile refactoring operation serving 11 different purposes. Finally, we found evidence that the IDE used by the developers affects the adoption of automated refactoring tools.

Analysis of Refactoring Practices Among GitHub Contributors

Refactoring is a pivotal software engineering practice aimed at improving the structure and maintainability of code without altering its external behavior. This paper, "Why We Refactor? Confessions of GitHub Contributors" by Silva, Tsantalis, and Valente, explores the underlying motivations for refactoring maneuvers among software developers on GitHub. Through empirical inquiry, the authors identify various motivations and assess the extent to which automated refactoring tools are employed, providing a nuanced perspective on how developers perceive and utilize refactoring in real-world contexts. The findings were drawn from a paper spanning 124 Java-based GitHub projects, involving thematic analysis of developer responses regarding their recent refactorings.

The paper reveals that refactoring is predominantly driven by evolving software requirements, such as feature enhancements and bug fixes, rather than by the traditional aspiration to eliminate code smells. Remarkably, only a quarter of the instances of method extraction were explicitly aimed at resolving code smells like code duplication or long method issues. The frequently cited reasons for refactoring also included improving code readability, testability, and enabling code reuse. Specifically, 11 distinct motives were documented for the ubiquitous "Extract Method" refactoring, highlighting its adaptability across various development scenarios.

Key aspects of refactoring practices unearthed in this paper include:

  • Diverse Motivations: Developers employ refactoring for a wider array of purposes beyond the elimination of code smells. These motivations include facilitating extensibility, enhancing readability, bolstering testability, and enabling code reuse across multiple contexts.
  • Automated Refactoring Tools: While many developers appreciate the efficacy of tools integrated into modern integrated development environments (IDEs), a significant portion (55%) of refactorings was still performed manually. The analysis suggests that automated refactorings are more prevalent in certain operations supported robustly by IDEs, such as IntelliJ IDEA, which reported a higher percentage of automated refactorings (71%) compared to Eclipse (44%).
  • Reluctance Toward Automation: Several factors contribute to the underutilization of automated refactoring tools, notably trust in the tool's precision for complex refactorings and a preference for manual intervention in trivial refactoring operations.

The authors posit that the findings should prompt the re-evaluation of how refactoring tools are designed, advocating for development approaches that align more closely with the actual tasks and motivations of developers in maintenance activities, rather than primarily focusing on code smell resolution. The implications of a tailored approach could not only enhance tool adoption but also improve the efficacy of refactoring practices in live development environments.

From a theoretical standpoint, this paper enriches our understanding of developer behavior concerning code evolution and emphasizes the multifaceted nature of refactoring beyond mere code improvement. In practice, these insights are instrumental in informing the design and implementation of refactoring tools that are attuned to the dynamic needs and preferences of software developers.

The research concludes that developers are generally inclined to incorporate refactoring as an integral part of their maintenance workflow, albeit selectively and cautiously in relation to the sophistication of tool support available. The specificity of refactoring motivations observed suggests a need for further exploration of context-aware tool recommendations that are responsive to the immediate requirements of software development and maintenance tasks.

User Edit Pencil Streamline Icon: https://streamlinehq.com
Authors (3)
  1. Danilo Silva (35 papers)
  2. Nikolaos Tsantalis (9 papers)
  3. Marco Tulio Valente (47 papers)
Citations (256)