The question ‘is programming art or engineering?’ has caused a lot of people to get quite upset with each other. I’d like to answer the question in a way that will hopefully put it to rest once and for all, but even if that doesn’t happen I hope it will give some perspective to those ‘dug in’ on either side of the argument and unable to appreciate that the other side may in fact have a point. People a lot smarter than me  and  have already written about this from the trenches on either side of the divide, and then there are giants such as Donald Knuth.
There are a lot of sides to the argument which makes it hard to come up with a single simple answer, and that is by itself already reason enough to slow down a bit and to try not to oversimplify the question.
The short version of this posting is ‘programming is both engineering and art’, but that really is too short.
The fight - as far as there is one - seems to center around several interpretations of what ‘art’ is, which is in itself a very fluid term. What was a ‘craft’ 200 years ago is now definitely art, and some contemporary craftsmen and women are definitely artists.
With terms that fluid and vague it is really hard to have an argument in which all sides will advance towards some kind of consensus.
I’ll try to stay within the dictionary definitions of what art and programs (programming) are:
http://www.merriam-webster.com/dictionary/art%5B2%5D (4 a), “the conscious use of skill and creative imagination especially in the production of aesthetic objects; also : works so produced”
The creation of programs: http://www.merriam-webster.com/dictionary/program (6 a), a sequence of coded instructions that can be inserted into a mechanism (as a computer)
Here are a number of arguments why programming is not ‘art’ as we usually use the term, the arguments are of varying strength and to every rule there are of course exceptions:
art can be appreciated by people other than those schooled in its creation, for instance a person could listen to a musical composition, look at a statue or a painting or read a poem, without any real skill in creating such works
art is unique to the artist, as a rule a given artwork could only have been produced by the original artist, and anybody else copying the art or its style would be found to be an imitator or engaging in fraud
artwork, as a rule can not be subdivided across any number of individuals schooled in the art to speed up the creation of the work, and is usually credited to an individual or at most a very limited number of people. An example is Michaelangelo, who (with a bunch of people to help with the ‘labour’ portion of the work) created all of the ceiling of the sistine chapel by himself and the work is credited to him alone.
programs written for the same problem according to a specification will produce the exact same output, no matter what goes on ‘under the hood’
And here are a number of arguments why programming is an art:
there is such a thing as ‘original’ work in programming, the first time someone came up with the ‘divide and conquer’ strategy (for instance, in quicksort) it was an act of creation
we speak of ‘advancing the state of the art’ when someone comes up with a solution for a previously unsolved problem in programming
programmers tend to feel the same sort of attachments to their work as artists in other fields do, they identify with their work and feel hurt when it is criticized
Much of the argument that programming is art seems to come from a group of people that have not yet mastered it to a level high enough to appreciate that most programming is in fact, really very simple and mechanistic. Idioms abound in programming, if you tell 10 different programmers that have all mastered the same programming language to write a program that will produce the first 10 numbers higher than 4 they will all come up with the same program, with maybe some formatting details different (and in some languages people will actually wage wars over those formatting details and call them ‘their style’).
But if you tell 10 different painters to draw a house the paintings will be fairly different, even though for painters that is probably an assignment roughly at the same level.
At such a simplistic level programming is definitely not art. In fact, it’s not even a craft, it is simply a mechanistic translation of a requirement in to a chunk of code that will produce a given output. You could use a loop, you could use a single print statement. But that’s about all the variation there is, assuming that you are trying to write your program in a non-convoluted way.
And for people that are not yet at a sufficiently high level, even simple programs can seem to be ‘works of art’. By the time they’ve finished the coding and the debugging of a relatively simple piece of software to them it might as well be art! And at a minimum it has become their baby.
But - and this is where I temporarily move to one of the trenches - in my opinion such programming is not art, even though I can appreciate the fact that for the creator it must feel like it is. I’ve read enough code to recognize ‘artful’ programming and I know that for the most part programming is ‘bricklaying’, which is not to diminish bricklaying in any way , it is a hard enough skill to acquire and if you’ve never made a simple straight wall you probably underestimate how hard it really is. Forget about arches and stuff like that.
Then there is the ‘craft’ part of programming, closely related to but not quite engineering. Programming is a craft when it gets a little harder. When a seasoned programmer has to grit his teeth over some problem, a constraint that is such that the solution is non-obvious, the timing has to be very precise or there is absolutely no room for error.
Suddenly the code becomes a lot harder to understand (as the famous t-shirt says, ‘if it would be easy, we wouldn’t call it code’).
Think of the software controlling a mechanical mill or a lathe, a nuclear power plant or the avionics on board of a fighter plane. This puts us solidly in the domain of programming as an engineering discipline, the best watchmakers would feel right at home there.
At this level programming is a joyful experience, usually if the responsibilities are sufficient there will be thorough code reviews and people will sign off on your code before it can go in to production to make sure that a single person can not - inadvertently or on purpose - cause a disaster. There is honour in such work and there is a great amount of satisfaction.
And finally there is the ‘art’ part of programming. To me, - and this is very personal again - the art part is there where no programmer has gone before. The trouble here is that only other programmers will be able to appreciate the artistry of what you’ve done. A layman would ask “And, does it work?” and if the answer is “Yes, the output is exactly the same as the old method which was 1000 times slower”, then for the layman the solutions are probably equivalent. After all, just wait few years and computers get faster anyway. Big-O complexity doesn’t mean squat to a layperson, they care about whether it works or not, not how it works. But your peers, your fellow programmers will be able to appreciate what you’ve done. They might even name an algorithm after you (or you get to name it yourself).
Of course, if you are not aware that someone has already trodden that road before you and you come up with what to you is a first and an original solution to a problem that does not diminish your feeling of being an artist at all. You even get to sign your work, and for a limited time you’ll feel original. But in the end you’ll probably find that some ‘graybeard’ was there when you were still in your diapers, especially if the solution for the problem fits on a single page of code.
Programmers should study the history of programming a bit better, just like artists are supposed to know that perspective has been ‘invented’ (and that was really artful, it advanced the state of the art of painting and drawing tremendously in one fell swoop, and it became as integrated in to painting and drawing as say sorting and searching are in programming). This will also help in placing the contributions of individuals against the proper background, it will stop people being placed on a pedestal for mere repetitions of what has gone before and it will help to recognize really original work when it appears the first time, instead of when it is rediscovered inevitably 30 years later.
So personal perspective of what constitutes art has a lot to do with it, and plenty of not-so-good programmers, myself included will have a feeling pretty quickly that they’re creating ‘art’, when in fact they are just re-inventing the wheel. But that’s fine, as long as it is a nice wheel and you get a good feeling out of it. Just like a woodworker that makes a particularly neat cuckoo-clock (I hate those things) can feel great satisfaction from his work, and there are already too many such clocks around.
Finally, something about the ‘magical’ component that separates those that can program from those that can’t. In the thread on , there is a reference to a study  that seems to try to make a link between being able to program and some ‘magical’ component that those that can program possess.
I think that’s a load of bull. Anybody, given an interest and sufficient time, can learn to program at a certain level. But for many people a dialogue with a machine is not an interesting one, and they don’t see the point of all this symbol manipulation to achieve effects that you could teach a toddler in 5 minutes flat (pick up the red triangles Johnny! (try to program a computer to do that, it’ll cost you years if you start from scratch)). And that’s an interesting problem to solve, at some level. Forget about most introductory classes in to computer science, if I had made my first steps like that chances are that I too would have been labelled as ‘unable to program’. In my experience, anybody can paint - a little, and anybody can program, a little. Apply yourself and you will advance your skill. You can’t be ‘tone deaf’ for drawing and I doubt there is a genetic component that makes you unable to program, unless you have serious mental handicap. For the most part everybody is ‘programming’ each other when they make a list of instructions on how to make coffee or how to bake a bread.
Teaching is programming to some extent, and I think that in the future, when we’ve finally gotten to that AI (be it 50, 100 or a thousand years ahead) we will teach it, we won’t be programming it.
And teaching is an art ;)