When and why your code starts to smell bad

  • Michele Tufano ,
  • Fabio Palomba ,
  • Gabriele Bavota ,
  • Rocco Oliveto ,
  • Massimiliano Di Penta ,
  • Andrea De Lucia ,
  • Denys Poshyvanyk

2015 International Conference on Software Engineering |

Published by IEEE

PDF | Publication | Publication | Publication | Publication | Publication | Publication

In past and recent years, the issues related to managing technical debt received significant attention by researchers from both industry and academia. There are several factors that contribute to technical debt. One of these is represented by code bad smells, i.e., symptoms of poor design and implementation choices. While the repercussions of smells on code quality have been empirically assessed, there is still only anecdotal evidence on when and why bad smells are introduced. To fill this gap, we conducted a large empirical study over the change history of 200 open source projects from different software ecosystems and investigated when bad smells are introduced by developers, and the circumstances and reasons behind their introduction. Our study required the development of a strategy to identify smell-introducing commits, the mining of over 0.5M commits, and the manual analysis of 9,164 of them (i.e., those identified as smell-introducing). Our findings mostly contradict common wisdom stating that smells are being introduced during evolutionary tasks. In the light of our results, we also call for the need to develop a new generation of recommendation systems aimed at properly planning smell refactoring activities.