Minimizing Maintenance Cost through Prioritizing Refactoring of Code Smells

Thumbnail Image

Date

2026-04-13

Journal Title

Journal ISSN

Volume Title

Publisher

© University of Dhaka

Abstract

Code smells are indicators of poor design practices that increase complexity, reduce comprehensibility, and hinder maintainability. While they do not directly affect system functionality, their long-term presence leads to higher maintenance costs and degraded software quality. Refactoring is the primary strategy to remove or minimize code smells. However, addressing all smell types is impractical due to time, budget, and resource constraints. Thus, identifying and prioritizing the most impactful code smells is essential for efficient maintenance and sustainable evolution of software systems. Code smell prioritization in existing literature is largely system-specific and often requires significant developer intervention. In other words, prioritization is typically applied to individual systems and tends to vary across different contexts. To address this research gap, the research conducts a large-scale empirical investigation aimed at establishing a generalized prioritization of code smells based on their impact on software quality and maintainability. Thirteen common smell types were examined across 35 open-source Java projects, analyzing their relationvi ships with 25 internal software quality metrics such as size, complexity, coupling, etc. as well as two maintainability metrics such as change-proneness and faultproneness. The study also incorporated perception-based insights from developers to compare subjective judgments with metric-driven analysis, uncovering notable discrepancies between these two. Finally, the research identified those code smells that exert the most detrimental effect on program comprehensibility, which is a key factor in reducing long-term maintenance costs. The results demonstrate that code smells vary in their degree of impact. Highpriority smells include Anti Singleton, Long Parameter List, Class Data Should Be Private, and Blob. Moderate-priority smells consist of Long Method, Complex Class, Large Class, Refused Parent Bequest, and Spaghetti Code. Finally, lowpriority smells are Speculative Generality, Many Field Attributes But Not Complex, Base Class Should Be Abstract, and Lazy Class. Alignment between developers’ perceptions and system analysis was observed for 61.54% of smell types, while 38.46% diverged, highlighting the need for developers to refine prioritization strategies to minimize maintenance costs. Finally, smells such as Long Method, Spaghetti Code, Refused Parent Bequest, and Anti Singleton were found to significantly degrade comprehensibility, with a correlation coefficient of −0.56 indicating that higher impact scores reduce comprehensibility. To summarize, the contributions of this research include an empirically derived prioritization of code smells, a comparative analysis of perception-based and metric-driven prioritization, and a synthesized dataset of 74,253 smelly files across 13 types. Collectively, these findings provide practical guidance for developers to focus refactoring on the most impactful smells, improve software quality, maintainability, and reduce long-term costs, while also supporting researchers in developing innovative refactoring tools and advancing future work in code smell management.

Description

This thesis is submitted for the degree of Doctor of Philosophy.

Keywords

Citation

Collections

Endorsement

Review

Supplemented By

Referenced By