Publication Date

Spring 2011

Degree Type

Master's Project

Degree Name

Master of Science (MS)


Computer Science

First Advisor

Robert Chun

Second Advisor

Mark Stamp

Third Advisor

Naveen Roperia


“Code Smell” or “Bad Smell”, at the very least, is an indicator of badly written code and is often indicative of deeper problems in software design. In layman terms, it signals flaws in the core foundation or architecture of the software that can cause any number of more serious problems – from usability and runtime performance to supportability and enhancement. These problems can mostly be prevented by the systematic refactoring of the code. Refactoring is the process (and according to some, an ‘art’) of making incremental changes to existing source code to improve its nonfunctional attributes, without modifying its external functional behavior. Code smells are symptoms of deep-rooted problems in design, which, in most common cases, inhibit the understandability of the system for present and future programmers, hence rendering the program un-maintainable. The later these problems are identified, the costlier they are to correct as it is much harder to refactor a system in production and regression. Issues caused by refactoring can spiral out of control in advanced stages of the software development life cycle. So far, identification of these code smells has been thought of as an intuitive art rather than an exact science, as there are very few empirical measures or methodologies for doing so.
In this project, I will examine each of the 22 code smells identified in prior research. I will implement Java Smell Detector (JSD), which will follow a scientific approach to detect five of these 22 code smells. JSD will give suggestions to refactor the code for all five of these smells. Further, the tool will provide an interactive process to refactor two of these cases; while for the rest, it will suggest an ideal refactoring technique that would need to be applied manually. I will be using Java code written by students of San Jose State University (SJSU) as test data for JSD and will compare its output against the code smells identified by the graduate students.