Beauty and Maintainability of Code
Ron Coleman · 2018
Software maintenance has been estimated to cost between 40% and 90% of the total build cost. Yet, the literature has given little or no attention to investigating whether good programming style can measurably affect maintainability and if so, how so and how much. This paper studies a fractal, relativistic approach to measuring programming style called the beauty factor (or "beauty") in relation to three different metrics of maintainability. We put forward two testable hypotheses. First, code with increasing beauty tends to be more maintainable. Second, beauty is distinct property of code. We test hypotheses on a corpus of 53,000 lines of open source code written by experienced systems programmers. We conduct statistical correlation analysis with 33 experiments in total. As the primary finding, the data show maximum statistically significant absolute correlation is |ρ|=0.61. In other words, at least 63% variations in beauty cannot be explained by variations in maintainability. These results lend support to both hypotheses. The data further show indentation is more reliably correlated with maintainability compared to mnemonics or documentation and GNU style is more correlated with maintainability compared to K&R, BSD, or Linux styles.