ArticleS. MichaelFeathers.
RevivingBeauty [add child]

Reviving Beauty

Earlier in the year, I attended SPA2005. The conference is held in England, and there are usually some very interesting sessions there. One I attended was called Searching for Beauty in Code. It was a great session but I told one of the organizers afterward that it would probably never fly in the US. In the US if you start talking about beauty, people no longer think that you are hard nosed and pragmatic enough to deliver business value, you're just one of those soft nosed people who needs to find a non-coding job.

And it's true. I don't think that session would fly in the US and, frankly, I feel a little sad about that. Googling for "beauty" and "code" I found this article: Turning Our Backs On Beauty ( http://www.devx.com/opinion/Article/21541 ) and it reminded me of how I feel sometimes when I'm working on good solid code. It is beautiful, and it is elegant. But, saying that in the context of a job, well, it's like bringing your personal life to work, talking about your kids at the drop of a hat. You want to say "look at how cool this is!" and share the fascination, but you're sure that you'll be met with "hey, it's just code, guy."

The truth is, there has been this undercurrent of appreciation for beauty in code in the industry for many years. You can tell when people have it. You can just see it. But people just don't talk about it. There is the appearance of pragmatism fear, and it's not an idle fear. If you appreciate very good code there is a chance that you could become a coding idealist, someone unable to make the cold pragmatic judgements that have to be made to ship. I really feel that that has happened over the past twenty years in many organizations. You can waste a lot of money shooting for perfection and we as an industry have been guilty of it. But, I think that there is value in recognizing that some code is just better than other code and that often aesthetics do overlap with pragmatism.

When I was younger, I once took my wife-to-be on a ride to see a freeway overpass, and amazingly enough she married me anyway.

Yes, I'm sure driving to see an overpass sounds silly, but to me it wasn't, it was just so cool. The overpass had very clean lines, and it was very well designed. Beauty and functionality dovetailed. In a way, the overpass was beautiful because it fit the problem it was trying to solve perfectly. To me, that's the definition of beauty in an engineering sense. It isn't what something looks like as much as how well it fits the problem. But, in a way, those two things are indistinguishable when you understand the problem that is being solved: the understanding makes it beautiful. And the key thing about seeing that beauty is that you appreciate the fit between the thing and the problem that it solves. When you do, you can become a better designer. Appreciation of beauty, in that sense, has a very practical value.

Some of you reading this are probably thinking of Christopher Alexander right now. He pioneered the concept of patterns in architecture and the idea migrated to software design about fifteen years ago. Alexander spoke about many of these issues, and he didn't really use the word beauty. In the future, I probably won't use the word either, but I think that there was some core understanding that he was hinting at that we haven't seen much in the use of patterns. It all comes back to this sense that a solution is intrinsically better if it fits a particular problem, and fits deeply. To me, it's okay to get pleasure from that and appreciate it.

Sure, pragmatism may drive us away from the fits we discover. Maturity in this profession is about being able to make those tradeoffs, but there is value in seeing those fits, appreciating that beauty. The people who do get better, and they have an inner drive to get better. I really think we need to find better ways to teach that way of seeing.

!commentForm
 Tue, 20 Sep 2005 18:37:13, Mike, Extreme pragmatism
I often see "pragmatism' taken too far. It becomes too easy to stop at "the tests pass" and never address that mounting technical debt. Experience has proven that keeping the code clean - beautiful even - pays off in the long run.
 Wed, 21 Sep 2005 19:01:11, Eddie de Bear, Code Beauty
What is Beautiful code?? As far as I'm concerned, it's clean, efficient and easy to read. Should we not be striving for this anyway?
 Wed, 21 Sep 2005 23:38:55, Michael Feathers, Code Beauty
I think it's that but there's something more. There's this thing that is sort of like economy. An example.. I stay in a lot of hotels and many of them have a hairdryer in the bathroom that turns off when you hang it up. Someone noticed that, well, you have to hang it up anyway, and it should be turned off, so why not make a single mechanism that solves both problems. If you can do that and it doesn't cause any other problems, it's a clear win.

If someone has a name for this, I haven't heard it yet, but it is the sort of thing that just brightens me up whenever I notice it in design.
 Mon, 26 Sep 2005 23:09:11, Devin Mullins, The sentiment is not new.
Though perhaps I'm oversimplifying...

http://paulgraham.com/paulgraham/taste.html
http://www.freesoftwaremagazine.com/free_issues/issue_06/focus-software_as_art/

Most of the time, when I look at code and think, "Wow, that's beautiful," I feel as if a weight was lifted off my shoulders. That's because a)I learned something from that code, and b)I imagine I might be able to use that new understanding to solve some of my own problems.

Whether or not the code is pragmatic depends largely on the factors under which it was constructed. A design that solves a problem is a good one, as long as that problem is a priority.

(I Might Be Wrong.)
 Wed, 28 Sep 2005 23:33:26, David Chelimsky, Dependent head hanging in aesthetic shame
I just finished writing a somewhat reactionary blog on why we should favor dependency management over aesthetics. But the truth is that I didn't get into software initially because of the joy of solving someone's business problems efficiently and making them money. I got into it because it was cool. Interesting. Complex. And, at its best, aesthetically satisfying - beautiful. Thank you Michael, for reminding me of this.

Maybe if I take the other blog down nobody would notice...

Don't take it down, I think it's just as important as this one. I really don't like the way we humans are wired. If I talk about beauty, someone is going to come along and say I'm being an idiot for not being pragmatic enough, and if you talk about pragmatism, someone is going to imagine that that involves not caring what things look like. I think we can have our cake and eat it too. It's just hard to talk about one thing without people making assumptions about what isn't being said. -- michael feathers
 Thu, 29 Sep 2005 18:57:56, Michael, Don't take it down, David
Hey David, don't take down your blog. It's one of the most interesting discussions I've seen on OOP in quite a while... it has a beauty too, given the discussion it generated. Give us more like that.

I agree. It was the most thought provoking blog I've read in a long while. -- michael feathers
 Fri, 2 Dec 2005 23:46:23, Jeff Olfert, code beauty
I've recently been experimenting with running my text source code through a high quality text to speech conversion, and listening to the result. It's and interesting way to review your own code for cleanliness, efficiency, and readability. Any else tried this?