Programming is an art

September 19, 2003 | View Comments (4) | Category: Programming

Summary: Why programmers should consider what they do 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. 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.

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 also. 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 more readily. 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.

Trackback URL: http://9rules.com/cgi-bin/mt/mt-tb.cgi/3

Comments

#1

I absolutely agree that Programming done right is an art form, but I have to challenge your use of the term "hackers". In the unix tradition, hackers are the most artistic of all the programmers. Hacking something together suggests low quality code, but a true hacker (as described by Eric Raymond) produces artistic code as a matter of course.

http://www.catb.org/~esr/faqs/hacker-howto.html#what_is

Simon Willison (http://simon.incutio.com/)

#2

Simon: You are right in that definition. I should have clarified that I was using "hackers" along with "hacks". However, we know great hackers like Alan Cox are not just people who throw something together without any thought.

Scrivs (http://www.9rules.com/)

#3

i'm not sure i agree with you on why artists create. i think true perfectionists create for themselves, because they are the only ones that are never pleased.

brianp (http://www.brianp.org/)

#4

Well then wouldn't you consider artists "perfectionists" because they sure don't do it for the money...at least most of them. They create what they want because that is their passion. Coders code becaus e they love to do it. Some people design because that is what they love to do. Once you find that love why not make it an art? You do care about what you do don't you?

Scrivs (http://www.9rules.com/)

Keep track of comments to all entries with the Comments Feed