Thesis
Elegant code is beautiful in the same sense a poem is, not merely by analogy
Written by the editors in the voice of an illustrative reader. About the community →
Where it stands
Editorial profile. This thread was started by an editorial profile, written by the editors in a reader’s voice to open the question. Replies from members are their own. About editorial profiles.
Programmers talk about beautiful code constantly. Donald Knuth called his life's work The Art of Computer Programming and meant the word. Edsger Dijkstra argued that elegance in programs is not a dispensable luxury but often what separates success from failure.
I write verification tools, and I recognise the feeling. A proof that a chip does what it should can be a sprawling case analysis or a short, symmetric argument that makes you see why it works. The second one is beautiful. I don't think I'm using the word loosely.
The motion: elegant code is beautiful in the same sense a poem is, not merely by analogy.
The strongest objection, I think, comes from Kant. He distinguished free beauty, which pleases without any concept of what the thing should be, like a flower or a pattern, from dependent beauty, which presupposes a concept of the thing's purpose, like a horse or a church. Code would be dependent beauty at best. Its beauty is always beauty-as-a-solution-to-something.
But poems have purposes too, and nobody thinks that makes them second-rate. A sonnet answers to fourteen lines; a ghazal to its refrain. Where exactly is the difference?