Monday, January 28, 2013

Repost: When Beauty is Not Truth

While it was not a field discussed in the article, When Beauty Is Not Truth, nonetheless I wonder about the focus I put on elegance in programming (starting with the name of the blog).  So let's consider a couple of quick things about Computer Science and the beauty of the code.  I should add that the article discusses a rough equivalence between beauty, elegance, and simplicity.

First, beautiful code is not always correct.

Second, beautiful code, by virtue of its simplicity, is less likely to have bugs.

Third, beautiful code is more readable, which facilitates comprehension.

(Now back to preparing the lecture for today's class)

2 comments:

Russell said...

Sometimes beautiful code is so short, dense, surprising and unique that it's just impenetrable to anyone but the author. In which case if speed or memory use isn't a factor, chuck it now.

Brian said...

I'd argue that code that "should be chucked" should not be seen as beautiful. But "beauty" is a qualitative ascetic, so your attribution of "beauty" to code can differ from mine.