A change in perspective can reveal insights into familiar subjects. We are accustomed to seeing programming through a scientific lens, as a discipline apart from artistic pursuits like music making. In fact there are many similarities between these crafts, and it can be quite helpful, at times, to think of a musician as an engineer, or to regard a programmer as an artist. Here follows a short list of the many similarities between musicianship and software development.
"Programs"
The lexicons of software and music share a word in common -- program. A musical program is a sequence of songs or musical compositions (a.k.a. a "set list"), which determines the pieces to be performed at a given concert. A computer program is a sequence of instructions which is used by a runtime to perform a computation.
Songs as code
Songs and other musical compositions themselves resemble software strikingly. Not only are they both composed of instructions that are interpreted to have some effect, but they also share a similar temporal quality. Both songs and programs are like recipes which can be interpreted from beginning to end to produce a sequence of effects in time.
Musical notation contains many of the features of a programming language, e.g. loops and conditionals, albeit with older and more arcane names. And just as there are complex forms of programs (interactive, non-deterministic, declarative, concurrent), there are analogous forms of musical composition (audience participation, improvised, aleatoric, and other non-linear forms).
It is notable how readily music notation has been encoded in software systems like MIDI. When looking at music encoded in this and other digital music notation formats it can be hard to distinguish it from software. Some music composition software goes further, removing this distinction completely (e.g. Haskore).
Interpretation
Both computer programs and musical works are interpreted. Just as the interpreter of a musical work can take liberties, make improvements, etc. so can software interpreters enhance programs beyond their author's intentions.
Teams
While both software and music can be developed independently, often the production of a composition or program involves the coordination of teams of people.
Exploring frontiers
It has been said that programming is not like conventional mechanical engineering. Writing a program is not like building a bridge, because software can be easily copied. Once you have built one bridge, the effort to build another, even if it is exactly the same, remains quite high. By contrast, once you have written a program, you'll never have to write that same program again, because copying programs is nearly free.
Music is very similar, especially when it comes to digital recordings. Once you've completely finished a recording, it's time to move on to the next one. While you might record multiple versions of the same song, it would be redundant to record for distribution a sonically equivalent version of a prior recording.
Live performance, is a bit different -- producing a live performance is not free -- but a similar principle applies as a composition does not need to be re-composed for subsequent performances. Once a composition is authored, any suitably skilled performer can play it with relatively little effort.
So the life of a programmer, like that of a musician, is lived on the frontier. To create art you must push against the edge of what is known.
It's all language
"Music is the arithmetic of sounds as optics is the geometry of light." -- Claude Debussy
That quote by the legendary composer and music critic, is entertaining and poetic, but as far as I can tell, it doesn't really mean anything. Perhaps something was lost in translation there. Tonally, it suggests a relationship between music and physics.
When it comes to music and programming, the strongest relationship between them is language itself. Music is integral to language acquisition, not to mention cognitive and emotional development. For this reason it is not surprising that music "speaks" to us. A non-linguistic mode of communication that is closer to speech than instrumental music would be hard to find.
Programming, as a practice, is really all about language acquisition. To code, you must learn a programming language, and then you must become fluent in it. Programming language designers, as they build their languages, swim in grammar, syntax, and semantics, and the programmers who use their languages are no doubt absorbing these things with the same mental machinery used to learn spoken language.
Musical programmers
There have been many musicians who learned to code and programmers who learned to make music. Two notable examples are Paul Hudak, co-inventor of the Haskell programming language, jazz improviser, and creator of the Haskore algorithmic music composition system, and Jef Raskin, early developer of the Macintosh, and author of The Humane Interface.
Many have noted the apparent affinity of programmers to musicianship, but I am unaware of any study that confirms this. If it were found that programmers were more likely than the average person to play a musical instrument, I wouldn't be too surprised.