Is programming similar to composing music?

DevToolsGuy / Monday, April 4, 2016

Over the last couple of decades, computer scientists with an interest in both musical composition and programming have managed to marry the two together. Artificial Intelligence can now compose music that is practically indistinguishable from that which is created by professional musicians.

It’s no secret that many professional developers have a real passion for music, and many musicians dabble in computer programming too. For example, Elvis Costello, the prolific British musician who’s been described as ‘the finest songwriter of his generation’ operated an IBM 360 in the 1970s before his musical career took off.

You can see why people might be drawn in by both concepts; There’s a lot that composing melodies and writing algorithms have in common. On the surface the two may seem quite disparate, but there is a creative side to developing, and a mechanical side to composing. So, just how similar is programming to composing music?

You’ve got the music in you

Let’s first take a look at the similarities between composition and programming.

 1.   They are both about following logical rules.

Composing music, just like programming, requires what the Ancient Greeks called the Trivium. You need:

  1. Grammar: a solid grasp of the fundamentals – be that musical notation and theory or knowledge of programming language rules
  2. Logic: you need to be able to create ‘logical arguments’. When writing music or code you need to follow logical rules to get the ‘moving parts’ to work together correctly.
  3. Rhetoric: as well as following grammar and logic, you need to be able to persuade listeners and users of new approaches to standard practice.

Without following the fundamentals of composition or development, things just don’t work. A haphazardly written program will be full of bugs, in the same sense an ill-formed chord structure will create dissonance.

 2.   They are about making something beautiful from small parts

To be a great pianist, you must first practice and perfect the basics: simple, repetitive scales and arpeggios. To be a great developer, you need to spend a lot of time ensuring even the simplest expressions are elegantly and correctly coded. Once you have the small pieces in place, you’re then able to build something greater, which is equally as important:

 3.   You need to be able to see the bigger picture

Just as a composer must consider all the different sections of the orchestra and how they will gel together, a developer needs to hold an abstract ‘bigger picture’ in their head as they start building their program’s architecture. Both disciplines are about building up towards something bigger and better.

 4.   Self-expression is key

Music and software development both require creativity and self-expression; both are about cultivating your own style and creating something new and inspiring.

 5.   You need to be technically engaged

Musicians and developers need to spend a long time thinking about how their creations will interact with other outputs, and in the hands of ‘end users’. A composer may add accent marks to instruct members of the orchestra the style in which to play. A guitarist may want to think about using external hardware (amps, effect pedals etc.) or how they want their song to be produced in the studio. Developers similarly need to bear in mind how others will use their end-products, on which kind of device and in what context.

 6.   They both include collaborative and individualistic aspects

Mozart might have spent a lot of time alone working out how his next composition would sound, yet his skillset also required working with others – namely the musicians he was conducting. Similarly, the most successful developers can’t be pure introverts; they need to collaborate with end users, managers, UX designers and so on.

I’m no musical dev

While there are a lot of things these disciplines hold in common, it’s worth hearing out the arguments against. Not every developer is set out to be the next Beethoven!

 1.   Is this kind of comparison just a way that we as developers puff up our egos?

As the author of the Coding Horror blog argues, comparisons that developers draw between their craft and painting, music or other art forms could be seen more as self-aggrandizement than a real comparison. Of course, we’d all like to think that the app we’re building is just as wonderful as the best of Gershwin, or that the website we just designed has the same lasting impact as Miles Davis’ Kind of Blue. But let’s be honest, it’s not quite the same thing, is it?

 2.   Programming is about solving a problem

When you’re asked to design an app, for example, it’s usually in order to solve a specific business or consumer problem. Developers excel at solving this kind of issue, yet can this really be compared to music? At its purest, composition should be about representing and inspiring pure feelings and emotion.

 3.   Programming has a very different purpose to music

When you develop any kind of tool, the final goal is for an end user to be able to do something specific with it. Say you’re building a business app – your creation should mean that the end user’s day to day tasks are facilitated. Music, by contrast, doesn’t really serve a specific ‘purpose’, beyond pure enjoyment.

Weighing the balance

The jury is still out on this one; while it’s clear that composition and development definitely hold certain factors in common, there are also a lot of areas where they diverge. What we do know is that both developers and musicians can enrich our lives and give us things we never knew we needed and which we now can’t live without.