Technical Difficulties from on Top of the Mountain
2004-07-05
  Computer Programming as Art
This topic is a favorate of Richard Gabriel, one of the founders of the Masters of Fine Arts of Software who has tried to apply the experiences he had pursuing a MFA in poetry to software.

Anyway, I finally had a chance to read Knuth's "Computer Programming as Art" speech given in 1974 (at his acceptance of the Turing award). He gives some interesting perspective on the history of "art" (where the word art was traditionally used as a counterpoint to science the way we use the word engineering now). He was also amused to find that scientists have been trying to get rid of the "art" in their fields for hundreds of years. From the preface to a textbook on mineralogy,

"Previous to the year 1780, mineralogy, though tolerably understood by many as an Art, could scarce be deemed a Science."
It looks like he was struggling with the same questions we were in January when we tried to identify "beauty" in software.
My feeling is that when we prepare a program, it can be like composing poetry or music; as Andrei Ershov has said, programming can give us both intellectual and emotional satisfaction, because it is a real achievement to master complexity and to establish a system of consistent rules.

Some programs are elegant, some are exquisite, some are sparkling. My claim is that it is possible to write grand programs, noble programs, truly magnificent ones!

He ended up with this list of general "goodness" for computer programs: While I think we had covered the first five in gory detail (we ended up with more than 60 properties if I remember correctly), Knuth points out a certain joy and skill in fitting programs into environments of limited resources. He recalls programming for one particular machine where he had only 4Kwords of memory. While he does not advocate arbitrarily restricting the resources programmers have to work with, he none the less felt that programmers rose to the challenge that resource limitations placed on a program.

While we have basically ceded the desktop as a hopeless land of bloatware, there still are plenty of domains where resources are still tight, and programmers have to be careful. From cell phones, to PDAs, to microwave ovens; small microcontrollers are being put to work every day with limited CPU cycles, memory and IO capabilities. Perhaps this is one reason why Java hasn't been a smash hit on portable devices: its style of programming (and VM itself) lead to decadence in resource usage. Programmers writing in Java don't think of the CPU costs or memory fragmentation resulting from the use of invariant objects and explicit assignments, they just plow right ahead creating and destroying hundreds of objects as they go about their task.

While I tend to go a little overboard, there are certain areas where the harder path should be taken up front (this is not premature optimization). For instance I have a template engine for a UI engine I am writing. At start up the app loads all of the assets into memory, so it can shoot it down the channel when needed. For templates, I process the file at loading, breaking it up into text blocks and variable names, so that macro expansion would just be a matter of going through all the pieces, putting the text blocks and looking up the variables. Another engineer on this project, when faced with the same problem just wrote a look running strstr() on the source text and doing string substitutions. His approach words, but I feel mine is the more elegant solution, and it was not that difficult or complicated to implement. Moreover it is a routine/module I will carry forward with me into the future and can apply to other solutions, where the strstr() solution is just throwaway.

[links]
Knuth's turing award lecture (PDF 750k scanned)

 
Comments: Post a Comment

<< Home
Life in the middle of nowhere, remote programming to try and support it, startups, children, and some tinkering when I get a chance.

ARCHIVES
January 2004 / February 2004 / March 2004 / April 2004 / May 2004 / June 2004 / July 2004 / August 2004 / September 2004 / October 2004 / November 2004 / December 2004 / January 2005 / February 2005 / March 2005 / April 2005 / May 2005 / June 2005 / July 2005 / August 2005 / September 2005 / October 2005 / November 2005 / December 2005 / January 2006 / February 2006 / March 2006 / April 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / February 2007 / March 2007 / April 2007 / June 2007 / July 2007 / August 2007 / September 2007 / October 2007 / November 2007 / December 2007 / January 2008 / May 2008 / June 2008 / August 2008 / February 2009 / August 2009 / February 2010 / February 2011 / March 2011 / October 2011 / March 2012 / July 2013 / August 2013 / September 2013 / October 2013 / November 2013 / December 2013 / December 2014 / February 2015 / March 2015 / July 2016 / September 2016 / December 2016 / April 2017 / June 2017 / July 2018 / November 2018 / January 2019 / February 2019 / April 2019 / December 2019 / March 2020 / April 2020 / May 2020 / September 2020 / November 2020 / March 2021 / May 2023 / June 2024 /


Blogroll
Paul Graham's Essays
You may not want to write in Lisp, but his advise on software, life and business is always worth listening to.
How to save the world
Dave Pollard working on changing the world .. one partially baked idea at a time.
SnowDeal
Eric Snowdeal IV - born 15 weeks too soon, now living a normal baby life.
Land and Hold Short
The life of a pilot.

The best of?
Jan '04
The second best villain of all times.

Feb '04
Oops I dropped by satellite.
New Jets create excitement in the air.
The audience is not listening.

Mar '04
Neat chemicals you don't want to mess with.
The Lack of Practise Effect

Apr '04
Scramjets take to the air
Doing dangerous things in the fire.
The Real Way to get a job

May '04
Checking out cool tools (with the kids)
A master geek (Ink Tank flashback)
How to play with your kids

Powered by Blogger