ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Is Beautiful Code A Succubus

(1/5) > >>

tinjaw:
I purchased the book Beautiful Code the other day and it sits on my read-when-you-want-to-read-about-code-instead-of-coding-and-not-feel-guilty stack. Jon Udell pointed me to an interesting blog article on rejecting the notion.

{ 2007 08 02 }
Beautiful Code

O’Reilly just published Beautiful Code. I was invited to contribute, but I just could not go along with the premise. I disagree that beauty is a guiding principle of programming. Here is how I responded.

read article
-Jonathan Edwards
--- End quote ---

Eóin:
Ah but doesn't it all depend on your idea of what beautiful code really is :)

For me beautiful code is the small chunks of self contained code that do something simple, but do it very well. Of course what I consider beautiful today could look very ugly tomorrow, but that's ok, beauty is never stationary- not in life and not code.

Lashiec:
Well, the first thing you must do to write beautiful code is to make it readable. That is, take advantage of tabs and indenting, separate code sections like loops from other more mundane, like definitions or repetitive single-line orders... I've been messing with lots of code that essentially looked like a text brick, including that wrote by teachers. And then, starting with that you extrapolate, breaking everything into independent chunks of code, that are easy to understand by themselves, using properly named variables, constants, functions and all the usual suspects... Maybe you don't get beautiful code (I think the concepts clash a bit) but at least you'll get something attractive and easy to read and understand for other people, including yourself.

f0dder:
A beautiful piece of code is... something that makes me smile at it's beauty.

It can be the terse elegance of something kernighan or ritchie have written, it can be C++ code that really is self-documenting, etc.

mouser:
I'm not sure the article really disagrees with the notion as it suggests it does.  Seems to me he's really saying that you can't expect not to get your hands dirty when you work in the real world.  Fair enough, but I do believe that striving for elegant/beautiful code is an important principle in coding.  If it looks ugly, chances are very good that you are doing something in a way you know could be improved.

This quote comes to mind:
"When I am working on a problem I never think about beauty. I only think about how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -- Buckminster Fuller

Navigation

[0] Message Index

[#] Next page

Go to full version