Elegance is a more philosophical topic than those usually considered in the study of computer science. The algorithms, languages, applications, and systems that lie at the heart of computer science do not need to be elegant to be scalable, performant, or even correct, after all, and so our instinct is to focus on those more concrete topics. Yet every experienced software developer knows, both instinctively and empirically, that some software is clearly elegant and most is definitely not.
This project attempts to better understand the nature of elegance in software and, if possible, to build a tool to help identify it in arbitrary programs. To that end, research regarding the nature of elegance in general, and specifically elegance in software, was first performed. The results of that research made clear that while elegance is subjective, there is likely a relationship between elegance and complexity. This idea drove the development of a tool for analyzing programs to predict how elegant human evaluators would find them. Development of the tool involved designing and deploying a survey to collect information from human evaluators about the perceived elegance of a selected set of sample programs, generation of a variety of common software complexity metrics for those programs, and the creation of a predictive model that combines those two data sets to predict the elegance of other programs. Analysis of the survey data collected and the performance of the predictive model support both the theory that elegance is related to complexity and also the idea that tools to identify it can successfully be built.