Which reference provides your definition of "elegant" or "beautiful" code?

Posted by Donnied on Programmers See other posts from Programmers or by Donnied
Published on 2012-10-14T14:48:33Z Indexed on 2012/10/14 15:49 UTC
Read the original article Hit count: 263

This question is phrased in a very specific way - it asks for references. There was a similar question posted which was closed because it was considered a duplicate to a good code question. The Programmers FAQ points out that answers should have references - or its just an unproductive sharing of (seemingly) baseless opinions. There is a difference between shortest code and most elegant code. This becomes clear in several seminal texts:

Dijkstra, E. W. (1972). The humble programmer. Communications of the ACM, 15(10), 859–866.

Kernighan, B. W., & Plauger, P. J. (1974). Programming style: Examples and counterexamples. ACM Comput. Surv., 6(4), 303–319.

Knuth, D. E. (1984). Literate programming. The Computer Journal, 27(2), 97–111. doi:10.1093/comjnl/27.2.97

They all note the importance of clarity over brevity. Kernighan & Plauger (1974) provide descriptions of "good" code, but "good code" is certainly not synonymous with "elegant". Knuth (1984) describes the impo rtance of exposition and "excellence of style" to elegant programs. He cites Hoare - who describes that code should be self documenting. Dijkstra (1972) indicates that beautiful programs optimize efficiency but are not opaque.

This sort of conversation is qulaitatively different than a random sharing of opinions. Therefore, the question - Which reference provides your definition of "elegant" or "beautiful" code?

"Which *reference*" is not subjective - anything else will most likely shut the thread down, so please supply *references* not opinions.

© Programmers or respective owner

Related posts about code-quality

Related posts about reference