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 about 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 them together and call it a house. Although it works, it will more than likely not stand the test of time. As a programmer/front end developer 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. Beautiful code has more to do with the functionality of the code and how it works than the actual 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.
In What is Design? I answered the question by saying:
Design is the process of finding the most elegant answer to the question of ‘how do I?
Does this not apply to code as well? We might not find the most elegant solution initially, but after a couple of iterations one would hope we would finally get there.
A lot of programmers are given code that is not theirs 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 GitHub 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. Beautiful code and design lasts like great pieces of art. There is a reason Ruby on Rails remains 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.
Granted, and this is where a majority of the coders start to nod their head, there just isn’t enough time to design the most elegant solution. You are under a crunch and you know an answer that will work, but will probably be ugly. By all means apply it and hopefully you have the chance later to come back and reiterate it to a more beautiful solution.
As programmers you are under tight deadlines 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 maybe it can be fixed easier than the spaghetti 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.
If you view the custom.css for this site you will see that I don’t really create complicated CSS. I happen to know where everything is so in my mind it is a good solution. Unfortunately, for someone else that might be looking to jump into it, it can take them a bit of time. That is not a good thing. Also because of the style of the CSS I can’t tell when I am redoing code that I could simply be reusing. How many lines of CSS do we waste by repeating attributes and properties for different elements?
In contrast if you look at the CSS for Flyosity, Mike Rundle takes his time to make sure that the CSS is logically indented to he can quickly jump back into it to make changes. You can tell he takes pride in his CSS.
#right_column {
position: relative;
z-index: 1000;
padding: 0;
top: -101px;
float: left;
width: 250px; }
.portfolio {
margin-bottom: 10px; }
.portfolio a {
display: block;
padding: 36px 15px 0 72px;
height: 30px;
text-decoration: none;
font: normal 12px "Lucida Grande", "Verdana", sans-serif;
color: #19a0d1;
margin-left: -11px;
text-shadow: rgba(255,255,255,.8) 0 1px 0;
-webkit-text-shadow: rgba(255,255,255,.8) 0 1px 0;
background: transparent url(images/portfolio_icon.png) 2px 8px no-repeat; }
.portfolio a:hover {
text-decoration: underline; }
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 we must learn to love our art.
Instead of having people drop in weeks after an entry is posted and leaving comments that won't get responded to, Drawar closes comments after two weeks so that the community can focus on more recent discussions. If there is a point you really want to make and feel that it can generate some great discussion, drop in the forums and start a topic.
Scrivs
01.18.10permalink