Programming is an Art
Buildings that serve a purpose and enhance the beauty of the environment around them are created by artists disguised as architects. Buildings that are hideous and need to be torn down are created by architects. The difference is that the artist takes pride in what he is doing. He understands that his work will be viewed by many people and therefore stakes his pride in the building. The architect knows that he got paid to finish something within a timeframe and therefore could care less how people see his building. In fact he does not even think the building is his anyways.
Hackers act the same way as architects. They gather bricks and cement and throw something together called a house that although it works will more than likely not stand the test of time. As a programmer you should not see your code as a means to an end. It should provide a source for others to look at and revel in its beauty. I do not mean that you should write a ton of crappy code, but use appropriate whitespace and indents (although whitespace and indents should be used appropriately for legibility). What I mean by beautiful code is more than the look of it. I want to get lost in the beauty of its design. I want to see how simple you make complicated sequences appear. A quick example is the Towers of Hanoi done using recursive functions. There are plenty of ways to go about this problem, but the recursive approach shows you how code can be an art. Although very rarely you see recursiveness used in large designs you must marvel at the simplicity of the design to such a complicated problem. To me simplicity of design is beauty.
A lot of programmers are given code that is not their’s and they are told to refactor it or make it work better. This is the greatest time for showing that programming can be an art and probably an even better time to wish that every programmer treated their code as an art form. It is like someone giving you a marble statue of something that appears to be a man and when you are done with it looks like David.
If you tackle your code as an artist then you are putting an investment into it. You are putting yourself behind the code so that the code represents you. A lot of open source projects need to take heed and listen. Just because you start a great idea for a project and start an account on SourceForge.net it does not mean you will draw in the legions of the open source army. No doubt you will draw interest, but if your code is a catastrophe and the design is horrific then that interest will die quickly, very quickly. Beautiful code and design lasts like great pieces of art. There is a reason Ruby on Rails is becoming very popular and it goes beyond the fact that 37signals hypes it.
Programming is an art because you are creating your own masterpiece. You are creating your own exhibit for the world to see. Artists don’t paint just so they can keep their works to themselves. They paint because they want the world to enjoy what they enjoy. Why should coding be any different? Of course if you are writing a small program for yourself, write it however you want. I write small little programs that serve my purposes, but I also design them as if I were letting the whole world see them. For some reason I can’t let bad design and ugly code get in my way. I take pride in what I do because I take it seriously and I wish others to take me seriously as well. Nothing is more fulfilling to me than someone telling me they respect me. If they only know me through my code, then I wish for them to respect my code. For this to happen I have to become the artist that respects his own work.
As programmers you are more than likely under a tight deadline so your main priority is to create working code. However, if the design is not thought out then that working code might be incompatible with the other components that it has to interact with. If there is an art to the design of the code, then even though the code is incompatible, maybe it can be fixed easier than the messy code. If something is hacked together quickly, that is understandable, but go back and fix it up. 99% of the time there is a more elegant solution to the problem.
See yourself as a master craftsman who has apprentices and journeymen coming from all over to view your code so that they may learn the art of programming. Take pride in your work not for others’ enjoyment, but for your own sense of self. We are artists and that is why we love our art.
*Note: I wrote this back in the days when I coded more, but now I am graced by the presence of Colin Devroe to handle all the code jiu-jitsu.




“Artists don’t paint just so they can keep their works to themselves. They paint because they want the world to enjoy what they enjoy.”
I don’t fully agree with this. There are artists who use art only as a valve to express their problems with the world, not for other people. Franz Kafka would be an example (in his last will he asked his friend to destroy all his unpublished work. Luckily for us, his friend didn’t.)
I do agree that there is beauty in simplicity, but I personally find it hard to accept simple and beautiful code as art. For me art means that the artist tries to express something in his own way, but there’s only one (best) way to write code for a certain problem (you mentioned the Towers of Hanoi using recursive functions). No room left for the writer of the code to express himself.
“If you get simple beauty and naught else, you get about the best thing God invents.”
-Robert Browning
By Daniel on June 8, 2006 6:56 am
In the Kafka example couldn’t you say he wished to share his frustrations with the world then? He isn’t sharing his joy, but he is sharing and uses his literary works as the medium.
Maybe the code itself isn’t the art, but the thought process behind it.
By Scrivs on June 8, 2006 7:09 am
Great quote by the way.
By Scrivs on June 8, 2006 7:09 am
David: only trivial problems have only one right solution, and even then it’s difficult to find one solution that is better than any other. There is such a thing as beautiful code. You’ll know it when you see it.
It’s much easier to see if you learn a non-mainstream language.
By Simen on June 8, 2006 7:13 am
How wonderful the world would be if there were only one right solution for every problem, but as Simen points out this usually only occurs with trivial problems. Would you want a trivial problem to have more than one solution? I think that would cause you to rack your brain more than is needed.
By Scrivs on June 8, 2006 7:20 am
This reminds me of the Zen Of Python.
In some ways it is the fault of computers being to powerful. When computers were less powerful people had to sit writing out code on paper and optimise it and clean it up before they were even allowed to put it through the computer. With the speed of computers now it doesn’t matter if your code is sloppy as the computer can run it fast enough there is no noticeable difference in speed.
By Eddie Sowden on June 8, 2006 7:47 am
Some time ago I made an analogy of how typewriters and word processors are killing great pieces of literature because people no longer have to worry about slaving over a piece of paper with a pen and correcting mistakes.
By Scrivs on June 8, 2006 8:16 am
Jui-jitsu rocks.
By Colin D. Devroe on June 8, 2006 8:48 am
I used to visit this site all the time when it was whitespace. The design was innovative and the content was pretty interesting. Now it looks like a ugly cousin of Slashdot, has a pretentious title whose latter half is the only part that seems accurate.
Artists make great buildings, architects make crap. This is about as insightful as a high school term paper. I’ve had enough, I’m unsubscribing. I’ve only written this because I’m pissed you ruined what was a good thing.
By shaZam on June 8, 2006 9:13 am
Some art, while beautiful, can also be inscrutable. I see a lot of code out there that is more “clever” than beautiful and easy to follow.
Instead of the painter analogy, I like to think of programming as an exercise in storytelling - when someone reads my code I want them to experience an “ah ha!” moment like you get when reading a novel.
By Patrick Fitzgerald on June 8, 2006 10:52 am
Maybe we shouldn’t have a programmer/painter analogy. I’ve always thought of programming as part art part engineering, there always seems to be some twisted way of coming up with code solutions, and this process is very similar to art-creating process.
I’m a pianist, and I feel similar vibes when I code and when I compose music. I can’t explain it clearly, it’s just a tingly feeling.
Maybe we should classify programming as a new type of art?
By Rami Kayyali on June 8, 2006 1:30 pm
I can sum up the message of this in one sentence, “make a personal investment in your work”. And that goes for anything, not just programming.
The article starts off drawing an arbitrary line between architects and ‘artists’ based on their attitude. It then measures their quality by referencing the public perception of their buildings. I’m sorry, but that is nonsense. First of all, the public perception of the building has absolutely nothing to do with the architect’s intention. Secondly, the quality of an architect is based on manifold principles (just like a programmer). Maybe you’re interested in coming in under budget, or dealing with complex building codes, or using unique materials, or working with constrained spaces. Architects have different strengths and weaknesses as well as no small variance in the amount of talent. If you’re saying that architects who are passionate about their job are better, then I agree, but that’s a trite superficiality that applies to anything.
Now as for programmers, I’m a firm believer that you can’t be a good one if you don’t have a passion for algorithms and code. In order to write good code you need solid fundamentals. You need education and experience. You need to understand a wide breadth of tools, and understand how real world problems can be mapped to empirical logic. The final culmination of all this knowledge is the ability to write clean, efficient and elegant code. You’re just not going to get there without passion.
All this ‘code is art’ business is just waxing poetic about the result. Some great programmers probably view it this way, and some don’t. It’s great if people can appreciate quality code. Granted. But to suggest that this view is what makes a great programmer is just silly.
It’s no accident that ‘beautiful’ code correlates with efficient and elegant code. More than architecture, and much more than typical visual art, code’s beauty is tied to functionality and maintainability. When writing code there is always tension between a great many considerations. Reusability vs efficiency, readability vs terseness, features vs interface simplicity, etc, etc. Once the functionality is spec’ed out there is some room for artistic flair, but it is always secondary to the primary concerns of meeting the requirements.
By Gabe on June 8, 2006 1:47 pm
As I do both web design and development I see the design process in both and always have. It might have something to do with my original ‘art’ being photography - this before digital (and a little after) was always a balance of science and art with developing your own images. I love being able to have both sides of my brain on any project and both design and development do this on their own. A designer has to balance the constraints of their medium no matter what their medium is.
When you start out in software engineering you spend a lot of time shadowing people and getitng the bum jobs of refactoring little functions and of documenting mainly code. While you are doing this you are learning the trade and finding out what is going on. As a result of my background in this, I started a love of documentation and what I call ‘elegant’ code. I mean elegant by form and function and good code shows this all.
By karmatosed on June 8, 2006 3:25 pm
._. I kind of agree with Gabe.
What you mean by art, I think it is more passion.
Professional sports players can love what they do. Some can even pull moves that can be quite elegant. Would this be considered an art?
Architecture in buildings and in software is about juggling contraints, limited by budget, time, labour, etc. Compromise! Sure, there are fancy buildings, but they are fancy for a reason which would lean more towards art.
Programming that works leans more towards the engineering than craftmanship. We want to build skyscrapers and not cathedrals. We want to minimize risk as much as possible. This is why people test softare and use short iterations. We want a repeatable process. It helps when things do not have to be re-invented each time, which is a big plus for Ruby on Rails. You even mention re-factoring code. It also depends on the industry the software is for too. But I guess I am digressing more towards software developement, and not just programming.
By Zelnox on June 8, 2006 7:22 pm
I sometimes envy people can speak the language. After reading (skimming) through various CSS books and several code examples, one could argue that I had acquired a basic understanding of the language. I can decipher the tags and with enough time and effort I could slap foreign together code to make something probably.
As an linguist, I am incapable of getting my head around CSS. When I look at the tags I see nothing but code. I can’t even begin to visualize what the code might look like when rendered.
I hate programming. But part of me knows that the skill is necessary to survive in today’s world. I guess this is how I feel about learning Japanese. I understand the words and the kanji but I can’t create the sentences for myself.
By the way, Paul this site…it’s doing fine. I’m so happy. I just subscribed to Wisdump and Business Logs. It must be great to be a good programmer and a good writer. Or do the two go hand in hand?
By Michael on June 9, 2006 4:17 am
i like the new design of wisdump.com :)
By Sebastian on June 9, 2006 11:37 am
Considering art any sort of rational-objective driven process is watering down the meaning and significance of true art. Programming requires a great amount of skill, experience and refinement. But it’s not art. It’s a craft. Art touches the soul and shifts philosophical standings, and code will never do that.
It’s funny but every body who’s passionate about what they do consider it an art. I’ve heard that design is art, accounting is art, and parking cars is art.
By Mark on June 9, 2006 5:52 pm
[...] It’s always fascinated me that people live in their own personal worlds that mix and mesh with the worlds of others they meet. So I was very interested to read this article that suggests coding (the writing of computer code and the building of computer software) is art. Previously mentioned, Scrivs makes an interesting case that starts out with a compelling first paragraph: “Buildings that serve a purpose and enhance the beauty of the environment around them are created by artists disguised as architects. Buildings that are hideous and need to be torn down are created by architects. The difference is that the artist takes pride in what he is doing. He understands that his work will be viewed by many people and therefore stakes his pride in the building. The architect knows that he got paid to finish something within a timeframe and therefore could care less how people see his building. In fact he does not even think the building is his anyways.” [full text] [...]
By Tales by the Fire » Blog Archive » The Worlds We Live In on June 10, 2006 9:37 pm
Bypassing the other comments…
I really loved what you said here Scrivs. I take much pride in my code and try to solve complicated problems with more elegant approaches in as many cases as I can. Although when I’m told to refactor some code, depending on the “crap factor” of it, I will try to convince the boss man that we may be better off if I just rewrite it from scratch.
On the matter of whitespace and indenting your code. I’m more concerned that the previous developer just keeps a consistent pattern. I never really expect someone to follow my rules - but only the rule of consistency. In the end, that will help me follow someones logic better.
Another point of the beauty of code, you’ll often find that just because something is written in OO, doesn’t mean it’s pretty - or even beneficial. There have been plenty of times (even with my own code) where I yell blasphemous curses on such poor implementations. There’s nothing worse than knowing you’re explicitly writing bad code into an application and knowing the thought that you might be the very person that’s going to have to clean it up 6 months later.
By Dustin Diaz on June 12, 2006 6:00 pm
[...] Original post by Scrivs [...]
By Programming is an Art » Project Syndicate on July 2, 2006 1:05 am
[...] Original post by Scrivs and software by Elliott Back Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages. [...]
By Cape Tech Herald » Blog Archive » Programming is an Art on July 8, 2006 9:50 am
[...] That is what I call quality writing, not a jumble of mess and texts. But that’s just the beginning, look deep into the blog you’ll find yourself inspiring by really good thoughts being put into every post made. Programming in an art, another post made from there that might change your perception on how you look at programmers, these days. [...]
By Design Enterprise » Blog Archive » Live as a designer on October 16, 2006 11:14 pm
“They gather bricks and cement and throw something together called a house that although it works will more than likely not stand the test of time.”
Nice to know that some software will stand the test of time (as long as mankind will) by beeing passed on from one generation to the next and thereby experiencing refinement, bug-hunting and general improvement.
One might be curious to consider a building like that…
By xraider on June 4, 2007 1:17 pm