Improving structural code quality of java source codes through automated detection and refactoring of code smells leveraging large language models (LLMs)

bracu.degree.levelUndergraduate
bracu.type.groupStudent Works
datacite.rightsOpen Access
dc.contributor.advisorAzmain, Md. Aquib
dc.contributor.advisorRifat, Riazul Islam
dc.contributor.authorDaraksha, Tahura Alam
dc.contributor.authorSikder, Hironmoy
dc.contributor.authorEsha, Khadija Farhana
dc.contributor.authorKamran, Fardin
dc.contributor.authorZawhar, Ganim
dc.contributor.departmentDepartment of Computer Science and Engineering
dc.date.accessioned2026-08-16T06:51:14Z
dc.date.available2026-08-16T06:51:14Z
dc.date.copyright2025
dc.date.issued2025
dc.descriptionThis thesis is submitted in partial fulfillment of the requirements for the degree of Bachelor of Science in Computer Science and Engineering, 2025.
dc.descriptionCataloged from PDF version of thesis.
dc.descriptionIncludes bibliographical references (pages 63-65).
dc.description.abstractStructural and design issues in source code, commonly referred to as code smells, can reduce software maintainability, readability, and overall quality. Traditional code analysis tools rely primarily on predefined rules and heuristics for smell detection, which often limits their ability to understand broader code context and provide meaningful refactoring support. Recent advances in Large Language Models (LLMs) have created new opportunities for intelligent code analysis and automated software maintenance. This thesis presents an LLM-based approach for the detection and refactoring of code smells in source code. The proposed framework employs two specialized models: a code smell detection model trained to identify common structural and design issues, and a refactoring model trained on paired before-and-after code examples to generate refactored code and identify the refactoring technique applied. The detection model recognizes several categories of code smells, while the refactoring model generates improved code by applying appropriate refactoring transformations. We are working to propose an automated engine that uses LLM to detect and refactor key code smells in deployed Java projects. Our proposed framework combines static code heuristics with parameter-efficient fine-tuning using for code smell detection. Additionally, a separate LoRA fine-tuned model is trained on before-and-after code pairs to perform refactoring , generating refactored code along with the corresponding refactoring type. We aim to find if the semantic understanding of LLMs are capable enough to find the common smells in deployed Java source codes and refactor to improve the quality of the codes. We will construct a dataset for internal testing and benchmarking. This work illustrates how LLMs can serve as intelligent assistants in software maintenance, enabling automated detection and context-aware refactoring.
dc.description.degreeBachelor of Science in Computer Science and Engineering
dc.description.statementofresponsibilityTahura Alam Daraksha
dc.description.statementofresponsibilityHironmoy Sikder
dc.description.statementofresponsibilityKhadija Farhana Esha
dc.description.statementofresponsibilityFardin Kamran
dc.description.statementofresponsibilityGanim Zawhar
dc.format.extent73 pages
dc.identifier.otherID 24241349
dc.identifier.otherID 22101284
dc.identifier.otherID 24141231
dc.identifier.otherID 21101023
dc.identifier.otherID 21201581
dc.identifier.urihttps://hdl.handle.net/10361/29143
dc.language.isoen_US
dc.publisherBRAC University
dc.rightsAttribution-NonCommercial-NoDerivatives 4.0 Internationalen
dc.rightsBRAC University theses are protected by copyright. They may be viewed from this source for any purpose, but reproduction or distribution in any format is prohibited without written permission.
dc.rights.urihttp://creativecommons.org/licenses/by-nc-nd/4.0/
dc.subjectLarge language models
dc.subjectLLMs
dc.subjectComplexity metrics
dc.subjectCode quality
dc.subjectIntelligent code analysis
dc.subjectAutomated software maintenance
dc.subjectSoftware management
dc.subjectSoftware restructuring
dc.subject.lcshNatural language processing (Computer science).
dc.subject.lcshComputer software--Development.
dc.subject.lcshSoftware failures--Prevention--Data processing.
dc.subject.lcshSoftware maintenance--Automation.
dc.subject.lcshJava (Computer program language).
dc.subject.lcshComputer programs--Correctness.
dc.subject.lcshDebugging in computer science--Automatic control.
dc.subject.lcshComputer software--Testing--Data processing.
dc.subject.lcshSoftware refactoring.
dc.titleImproving structural code quality of java source codes through automated detection and refactoring of code smells leveraging large language models (LLMs)
dc.typeThesis

Files

Original bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
24241349, 22101284, 24141231, 21101023, 21201581_CSE.pdf
Size:
710.13 KB
Format:
Adobe Portable Document Format

License bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
license.txt
Size:
1.71 KB
Format:
Item-specific license agreed upon to submission
Description: