Adam Gerber, Clifton Craig · Apress eBooks · 2015
The solutions you develop in Android Studio will not always follow a straight path from design to finish. To be an effective Android programmer, you need to be flexible and refactor your code as you develop, debug, and test. In the preceding chapter, you learned how Android Studio can generate code; in this chapter, you're going to see how Android Studio can refactor your code. The greatest risk with refactoring code is that you may introduce unintended errors. Android Studio mitigates these risks by analyzing the consequences of certain risky refactoring operations, and then activates the Find tool window, in which you may preview your changes—flagged with any errors or conflicts—before committing them.
Cited by 0
Bruce E. Johnson · Apress eBooks · 2020
In Chapter 3 , “Unit Testing,” red/green/refactor was introduced as a development paradigm. Through unit testing, it was possible to achieve the red and green portion of that triumvirate. What was missing from the discussion was refactoring, which, fortunately for people who read books from front to back, is the topic of this chapter. After a brief description of the function and form of refactoring, you will learn about the many different tools that Visual Studio 2019 brings to bear to help with this step.
Cited by 1
Arie Van Deursen, Leon Moonen, Alex Bergh et al. · 2001
Two key aspects of extreme programming (XP) are unit testing and merciless refactoring. Given the fact that the ideal test code / production code ratio approaches 1:1, it is not surprising that unit tests are being refactored. We found that refactoring test code is different from refactoring production code in two ways: (1) there is a distinct set of bad smells involved, and (2) improving test code involves additional test-specific refactorings. To share our experiences with other XP practitioners, we describe a set of bad smells that indicate trouble in test code, and a collection of test refactorings to remove these smells. Keywords Refactoring, unit testing, extreme programming. 1
Cited by 1
Farooqi, Sadaf · Zenodo (CERN European Organization for Nuclear Research) · 2025
Software development life cycle process describes every phase of software product development. Implementation is one of the most important phases of SDLC. With the evolution of the digital era, the need to develop good-quality software products in minimal time is essential. DevOps is a fast-growing software development paradigm where strong collaboration between development and operations teams is required. Clean code and refactoring provide the best solution for improving maintainability and quality. This research explores sufficient conditions required for successful refactoring, including clean code, testing, coding standards, and DevOps practices. A comparative analysis highlights that clean code and DevOps have the most significant impact on refactoring success.
Cited by 0Open access
Marcus, Sven · Zenodo (CERN European Organization for Nuclear Research) · 2022
A SURESOFT Workshop about applying Clean Code and Refactoring techniques to research software in order to produce maintainable and understandable code.
Cited by 0Open access
2024
In this chapter, you will learn how to use Copilot as a refactoring pairprogramming assistant.While code refactoring tools such as VS Code language services and JetBrains ReSharper help you make safe refactors for your code, you can use Copilot as a pair programmer in your refactoring efforts.Copilot can assist you in exploring better ways to write your code and even assist you when making changes.You can download a copy of the starter project todoapi-ch08-starter in the Chapter 8 folder.www.wiley.com/go/programminggithubcopilot Introducing Code Refactoring with Copilot Establishing the Example Project Refactoring Duplicate Code Refactoring Validators Refactoring Bad Variable Names Documenting and Commenting Code Introducing Code Refactoring with CopilotCode refactoring is the process of modifying internal code without changing its external behavior.Before you begin refactoring code, you must have Code Refactoring with CopilotProgramming with GitHub Copilot: Write Better Code-Faster!.
Cited by 0Open access
Eduardo Oliveira, Hieke Keuning, Johan Jeuring · 2023
Teaching students to develop code of good quality is important. Refactoring -- rewriting a program into a semantically equivalent program of better quality -- is a common technique to improve code quality. It is therefore relevant for students to learn about refactoring, even for the smaller programs they write as beginners. However, students make mistakes when refactoring programs. Some of these mistakes appear often, and might be caused by misconceptions they have. In this paper, we investigate common student code refactoring misconceptions. We do this by analyzing log data containing program snapshots of students working on refactoring exercises in a tutoring system. We manually inspect all transitions from a correct program state to an incorrect state. We then use grounded theory to identify and categorize misconceptions students might have when refactoring programs. As a result, this work (1) defines the concept of refactoring misconception, and (2) provides an initial list of 25 such misconceptions, together with an accompanying website with full details.
Cited by 13
Anonymous · Zenodo (CERN European Organization for Nuclear Research) · 2025
RefacAgent Results Folder results: experiment data for four RQs RQ1: The evaluation results of RefacAgent on 10 Java projects, along with the results of CodePrompt. RQ2: Evaluation results of EM-Assist and RefacAgent with GPT-3.5-Turbo on 10 Java projects RQ3: User servery links and responses RQ4: Ablation study PS: Due to some limitations, the website can't show full content of the results, please download check the README.md and the details. Static Folder static: images and other resources approach-overview: the overview of the approach diagram rag_overview: the overview of building contextual RAG Detail Result of Data Leakage Evaluation Period Type # Refactoring Percentage Compile & Test RM Detection Refactoring Success Success Rate Post-Cutoff Atomic 211 75.63% 176 163 161 76.30% Compound 68 24.37% 66 60 60 88.24% All 279 100% 242 223 221 79.21% Pre-Cutoff Atomic 329 77.59% 305 301 287 87.23% Compound 95 22.41% 89 80 74 77.89% All 424 100% 394 381 361 85.14% Code Folder code: the code for the RefacAgent rag: code for building contextual RAG and retrieving relevant examples. utils: contains functions for operating project, such as switching project commits, reading files, and extracting project structure. data: including specific prompts, the static tools used, and the runtime temporary folder. model: the refactoring entity used in the whole project config.yaml: configuration for RefacAgent requirements.txt: the requirements for the RefacAgent multiple_agent_rag_refactoring_main.py: the main entry of the RefacAgent clone.sh: script to clone the project code to be analyzed Prompts Here we list the prompts for all workflow: /code/data/prompts/ Configuration There are four configurations in config.yaml that need to be set. project_prefix_path: {Path to your project directory, e.g., /Users/xxx/xxx/RefacAgent/code} OPENAI_API_KEY: {Your OpenAI API key} chromadb_host: {ChromaDB host address; use "localhost" if running ChromaDB locally} project_name: {Name of the evaluation project, e.g., "commons-io"} How to run the code set up install the requirements. install the chromadb vector database. the guide link: trychroma once the installation is complete, you need to configure chromadb_host in the config.yaml. it is recommended to use a local Docker installation, as it is more convenient. install the jenv, a tool for switching between different Java versions. the guide link: jenv install Java 8, Java 11, Java 17, and Java 21 using jenv install the build system (Maven and Gradle) run clone.sh to clone the project code to be analyzed configure project_prefix_path, OPENAI_API_KEY, project_name in the config.yaml. run cd ./code && python multiple_agent_rag_refactoring_main.py
Cited by 0Open access
Xi Ge, Saurabh Sarkar, Jim Witschey et al. · 2017
Code review, where developers manually inspect one another's code changes, improves software quality and transfers knowledge in a team. Unfortunately, tools that support code review treat behavior-preserving changes, or refactorings, and behavior-altering changes, or non-refactorings, the same way, so developers have to spend effort differentiating between the two before they can evaluate the impact of a change set. In this paper, we describe a formative study of 35 developers that motivates the need for separating refactorings from non-refactorings during code review. Then, we present a refactoring-aware code review tool, called ReviewFactor, that differentiates between refactoring and non-refactoring, and allows developers to focus on one of them at a time. Finally, a case study of two open source projects suggests that ReviewFactor detects refactorings in 39% of the commits, and identifies 4.6% of the total lines of code change as refactorings. Our results also show that the precision and recall of ReviewFactor's refactoring detection algorithm are 92.5% and 94.2%, respectively.
Cited by 38
Eduardo Guerra, Clovis Torres Fernandes · 2007
Test driven development is a technique in which the refactoring occurs all the time, in the application code and in the test code. But there is not a method to guarantee that the test code behavior after one refactoring remains unchanged. This paper presents a representation based on the JUnit unit test structure, as well as a classification of test code refactorings that may ease the analysis to verify if the test code refactoring was carried out safely, i.e., if the observable behavior of the refactored test code has been kept unchanged. The use of this proposed technique may safely improve and speed up the production of test code refactorings.
Cited by 39
Farooqi, Sadaf · Zenodo (CERN European Organization for Nuclear Research) · 2025
Software development life cycle process describes every phase of software product development. Implementation is one of the most important phases of SDLC. With the evolution of the digital era, the need to develop good-quality software products in minimal time is essential. DevOps is a fast-growing software development paradigm where strong collaboration between development and operations teams is required. Clean code and refactoring provide the best solution for improving maintainability and quality. This research explores sufficient conditions required for successful refactoring, including clean code, testing, coding standards, and DevOps practices. A comparative analysis highlights that clean code and DevOps have the most significant impact on refactoring success.
Cited by 0Open access
Zhala Sarkawt Othman, Mehmet Kaya · 2019
Refactoring duplicate code is an important issue and is one of the most important smells in software maintenance. There is an important relationship between clones and code quality. Most programmers use clones because they are cheaper and faster than typing the program code. A cloning code is created by copying and pasting the existing code fragments of the source code with or without slight modifications. A major part (5% to 10%) of the source code for large computer programs consists of copy codes. Since cloning is believed to reduce the possibility of software maintenance, many techniques and cloning detection tools have been recommended for this purpose. The basic goal of clone detection is to identify the clone code and replace it with a single call to the function, where the function simulates the behavior of one instance of the clone group. This research provides an overview of the refactoring IDE. The aspects of cloning and detection of cloning are explained. In the copy detection algorithm, the source code is created in XML format.
Cited by 2
Muhammad Naufal Pratama, Panji Wisnu Wirawan, Edy Suharto et al. · AIP conference proceedings · 2025
Cited by 0
M. Kleyman, S. Tyszberowicz, A. Yehudai · 2007
One of the principles of the agile development methodology is to "welcome changing requirements even late in development". Refactoring is a major technique used to cope with changes. It enables to reorganize code while preserving the external behavior. Several refactorings can be performed automatically. Aspect oriented programming (AOP) is a powerful technology that greatly improves programmer's ability to quickly introduce changes to a software system. AOP enables easily modifying behavior of numerous locations in the system code or adding new behavior. AOP is perceived by some people not to be mature enough; hence they avoid using it in production software. We have developed ACME, a prototype tool that implements a refactoring process for aspects. ACME enables a developer to convert AspectJ code to pure Java code according to conversion patterns. The available patterns are creating a singleton class from an aspect and merging aspects into existing classes. The tool creates modular and readable object-oriented code. This paper presents ACME functionality using example transformations and discusses the tool's applicability and decisions made during its design.
Cited by 1
Anshul Khairnar, Aarya Rajoju, Edward F. Gehringer · 2025
This Innovative Practice full paper explores how Large Language Models (LLMs) can enhance the teaching of code refactoring in software engineering courses through real-time, context-aware feedback. Refactoring improves code quality but is difficult to teach, especially with complex, real-world codebases. Traditional methods like code reviews and static analysis tools offer limited, inconsistent feedback. Our approach integrates LLM-assisted refactoring into a course project using structured prompts to help students identify and address code smells such as long methods and low cohesion. Implemented in Spring 2025 in a long-lived OSS project, the intervention is evaluated through student feedback and planned analysis of code quality improvements. Findings suggest that LLMs can bridge theoretical and practical learning, supporting a deeper understanding of maintainability and refactoring principles.
Cited by 0
Swathi Turai, Praneetha Potharaju, Rajasri Aishwarya Bepeta et al. · World Journal of Advanced Engineering Technology and Sciences · 2025
One of the most difficult aspects of software development is maintaining and updating legacy code, which frequently requires a significant investment of time and energy to make the code more manageable, efficient, and readable. Using sophisticated AI, such as machine learning and large language models, the AI-Powered Codebase Refactorer is a clever tool made to make this process easier. It converts jumbled or out-of-date code—such as old Python or Java projects—into more organized, contemporary, and well-documented forms. The tool makes the code much easier to understand by adding useful comments and producing external API documentation in addition to applying best practices like modularization and design patterns to improve code structure. In order to make sure the code continues to function properly after changes, it uses automated tests and static analysis, which goes beyond simply tidying up syntax. Whether it's for system software, data tools, or web apps, this AI modifies its methodology to suit the particular project. Developers can reduce technical debt, save time, and maintain the functionality of critical software by automating a large portion of the refactoring process.
Cited by 0Open access
Xi Ge, Saurabh Sarkar, Emerson Murphy-Hill · 2014
Software developers review changes to a code base to prevent new bugs from being introduced. However, some parts of a change are more likely to introduce bugs than others, and thus deserve more care in reviewing. In this short paper, we discuss our ongoing work to build a reviewing tool that automatically determines which changes in a change set are refactorings, uses this information to help the developer distinguish between refactoring and non-refactoring changes, and ultimately reduces the time it takes developers to review code accurately. We also discuss the challenges and opportunities we have faced when building this refactoring-aware code review tool.
Cited by 20
Khairnar, Anshul, Rajoju, Aarya, Gehringer, Edward F. · ArXiv.org · 2025
This Innovative Practice full paper explores how Large Language Models (LLMs) can enhance the teaching of code refactoring in software engineering courses through real-time, context-aware feedback. Refactoring improves code quality but is difficult to teach, especially with complex, real-world codebases. Traditional methods like code reviews and static analysis tools offer limited, inconsistent feedback. Our approach integrates LLM-assisted refactoring into a course project using structured prompts to help students identify and address code smells such as long methods and low cohesion. Implemented in Spring 2025 in a long-lived OSS project, the intervention is evaluated through student feedback and planned analysis of code quality improvements. Findings suggest that LLMs can bridge theoretical and practical learning, supporting a deeper understanding of maintainability and refactoring principles.
Cited by 0Open access
Ewa Figielska · SHILAP Revista de lepidopterología · 2022
In this paper, several refactoring techniques are shown, using an example in which the design of a program for solving a simple problem is gradually improved. Before introducing any change to the program, the drawbacks of its current version are discussed, bad code smells are identified, and some unit tests are provided. The source code is written in Python.
Cited by 0Open access
Burchard, Evan · 2017
Cited by 0