Tom Butler's programming blog

Is programming an art form?

Introduction

Although I have a BSc (Bachelor of Science) degree, is programming really a science? It's applied knowledge: the basis of programming is finding a creative solution to a given problem using the tools available. After all, I wasn't taught a list of problems and their solutions, I was taught how to use the tools which allow me to implement my own solutions to a given problem. The code is the programmer's expression of the essence of the problem at hand. Unless you can do this, being able to tell the computer what to do is meaningless. Without wanting to wander into the realms of discussing "What is art?" and the definition of "art" as a whole, here's why I think programming can be considered art:

The creativity required to produce a good piece of code is considerable, though some will argue it's simply a matter of knowledge. But don't all artists need to learn to work with their chosen medium? Nobody can pick up a musical instrument and play it without first learning how.

Programming is not dissimilar. A novice guitarist can pick up a guitar and follow the notes to play a song just as a novice programmer can follow existing code and replicate it to produce the same outcome. The difference between novices and experts in both cases is the ability to adapt and to transition between wanting a desired result and actually being able to achieve it.

A beginner musician will be able to create something that sounds ok, but a professional will have the ability to make something beautiful and elegant. In programming, a the beginner will be able to produce something which generates the expected result but a professional finds a way to do it in an incredibly eloquent and beautiful way.

Give two musicians the same song to play and you'll get two different variations of the same song. Give two programmers the same problem and you'll get two working solutions which probably work in entirely different ways. Both the songs and the code can be analysed from a technical perspective but there is more to it than that.

After all a good, technical solution is one which takes the input and consistently delivers the required output. In programming, terms such as "testability", "maintainability", "scalability" are often thrown around in an attempt to somehow quantify the technical aspects of a given approach. This, however, is not enough, there is so much more involved than just creating a technically complete solution.

These traits, at least to a degree, are measurable but often it's impossible to achieve all these technical feats. There is almost always a trade off and compromises which must be made purely at the discretion of the programmer. For instance, introducing such desirable effects as scalability and flexibility into a program will almost certainly sacrifice performance and simplicity, yet all 4 of these program traits are seen as "Good". It's possible to give weightings to the efficacy of each trait, but it will differ per project and be based wholly the programmers own opinions and what matters to them. It has no effect on the usefulness of the final program yet to programmers it is important.

Is engineering an art from?

Perhaps then, a better parallel is engineering or architecture. Cars, planes and buildings; like computer programs are, at their core, functional pieces of technology. Yet some are better than others, either technically, aesthetically or both.

Isn't the inside of an engine a beautiful thing? Even to those who have little understanding of how it works, they can appreciate the craftsmanship required to create it and the creative progression of the underlying technology and processes which are required to create it.

In programming, the end users can't see, hear, or touch the underlying code. Most don't even care, some are unaware that it even exists. It's hidden away, does that mean it can't be appreciated? As programmers we share the ability to recognise well constructed, beautiful, code for reasons beyond the technical. The thought process needed to imagine a desired result, being able to see beyond an existing solution and come up with something new, even the basic initial thought of "this is what I want the computer to do" is an entirely creative one. Inspiration is needed to want to create something. This has roots in creativity, something all the best programmers have, even require. What makes someone want to write a program? They want the computer to do something. That is pure creativity, often as a creative solution to a practical problem. Much like a car or a building, something initially conceived for an entirely functional purpose can become so much more.

Like any artist, I enjoy working with my chosen medium, I take joy in programming. I find the contrast of being able to take cold hard logic and use it creatively to produce something unique, meaningful and intriguing. I suppose thats why I'm a programmer. If I can refactor a piece of code to work in a cleaner, more concise, easier to read way; even if it serves no technical purpose I will. This is where programming becomes art. This is the point at which the code becomes more than instructions for the computer, it becomes something more. The code alone begins to have meaning and eloquence beyond its initial goal and I like to believe someone else looking at my code would appreciate the beauty of it. It requires a significant amount of creativity--not just technical know how--to design and build a computer program. Something which is often overlooked.

Unlike mathematics and science there is rarely a "correct" answer. There are often hundreds of ways to express the same thing. Programmers, like artists, are inspired by the work of others then build on or contend established principles. This happens in science too but in science it is based solely on the discovery of new data rather than the ideas of individuals. In programming there is no "new data" or discoveries. Any "discovery" or new technique is based entirely on someone's creative solution to a new or existing problem.

Programmers have to come up with entirely conceptual ideas and metaphors to explain what they are trying to achieve. The ongoing debates about "best practices" and whether a certain methodology is "right" or "wrong" because is does/doesn't fit an existing or desirable paradigm often invoke a lot of emotion and heated discussion. Is this not art?