Do Automatic Refactorings Improve Maintainability? An Industrial Case Study — Csaba Nagy

This session is describing a project by the Hungarian government to help companies to improve their source code. Gabor worked on this topic earlier (SCAM 2014) investigating whether automatic refactorings are worth it (find link later)

A number of plugins were developed for Eclipse and INtelliJ, connecting to SourceMeter. With this, developers could apply automatic refactorings, using the plugins. Developers were asked to mark commits as ‘refactoring’. With this data, Gabor could determine what the effect of the refactorings was:



Overall, about half of the refactoring commits increased maintainability, 10% decreased it and 35% did not have an effect on maintainability. Sometimes, with a fix, new issues were introduced (empty catch block => avoid PrintStackTrace). Some fixes drove attention to unidentified problems, like an unnecessary constructor.


gabor found that developers were reluctant, even though there was money in this case. It was not that they thought that it was that they thought it was perfect, but they wanted to do it with the minimum amount of effort. A related finding was that they went for the easy refactorings: unused constructor, empty catch blocks etc. Furthermore they prefered ‘batch refactorings’: fix a number of things in one commit. Even while Gabor asked them to minimize that.

Most interesting find (my opinion) they accepted automatically suggested patches, even if they would have manually done it another way.

In general: developers were positive: they trusted the algorithm, they were constructive and eager to use the tools.