Getty Images/iStockphoto

Tip

Abstract pattern recognition skills aid developers and musicians

What do good programmers and musicians have in common? The ability to recognize and apply abstract patterns helps both roles keep their work in harmony.

One of the great myths in the technosphere is that musicians make good programmers because music is like math.

I disagree. Music is not enough like math for any relevant or significant skill transfer. A programmer may know how the rules of counterpoint apply to Bach's Two Part Inventions, but that knowledge won't help to create an efficient hashing algorithm or an elegant caching algorithm.

However, there is convincing empirical evidence to support the assertion that musicians do, indeed, make good programmers.

There is a correlation between musical ability and the capability to program. Famed musician Thomas Dolby created the rich music format file type. Radiohead guitarist Jonny Greenwood programmed in BASIC as a child. Roger Powell, keyboard player for Todd Rundgren's band Utopia, was a senior programmer at Apple from 1997 to 2009.

I personally know many musicians who have made a living slinging code. I've gone to a few tech conferences that hosted evening festivities in which attendees gathered to jam, using instruments provided by conference sponsors. In fact, I once aspired to be a working musician, only to meander into programming later in life.

Indeed, there seems to be a significant correlation between music and programming, but it has nothing to do with math. It's about the ability to identify and work with abstract patterns.

Abstraction is critical to music

Before we get into abstract patterns in software, let's explore the musical nature of abstract patterns.

Imagine you walk down the street and hear sounds coming out of a window. You identify the sound as the song "Stairway to Heaven" by Led Zeppelin. It's a popular tune that you've heard dozens of times before, so identification is easy.

You continue down the street and pass another window. You hear another sound, only this time it's the opening from Beethoven's Fifth Symphony. You've heard that opening a dozen times as well, probably since you were in elementary school. The dah-dah-dah-dah is easily identifiable.

This scenario raises two important questions. First, how did you know the sounds were musical and not just noise? It's because each sound represents an identifiable abstract pattern. Secondly, how did you know that one piece was by Led Zeppelin and the other by Beethoven? These patterns have a consistency that makes them distinguishable from each other.

There is something Led Zeppelin-ish about "Stairway to Heaven" (Editor's note: One might call it Spirit-ual ...), just as there is something Beethoven-ish in the Fifth Symphony. There are patterns in play that enable listeners to attribute the music to the composer. They're probably very abstract, but you can sense them intuitively. It takes time and experience to pinpoint them.

Unlike other art forms, music is temporal -- it unfolds over time. A sculpture will always exist, regardless of who observes it and for how long. Music, on the other hand, is an abstraction confined to the span of time in which it happens. A melody exists only in your head. You need time to process music and appreciate it. When the music stops, it no longer exists.

The abstract nature of software

The notion of abstract patterns is intrinsic to software as well. Once you turn your computer off, the software no longer exists. There is code that describes how the software behaves over time, but that code merely represents the software; it is not the actual software itself.

The analogy is that of a musical score. Beethoven wrote down the bars and stanzas of the Fifth Symphony, but the music isn't realized -- it doesn't become "music" at all -- until the musicians in the orchestra play that score.

It's the same way with software. Think of your code as the score that the computer executes to realize the software.

Abstract patterns in software and music

Both music and software are abstractions that are realized over time. Musicians, particularly musicians who improvise a lot, are very good at identifying abstract patterns. Jazz musicians, for example, can hear a tune, figure out the underlying chords and then solo against those chords using the tune's main melody as a foundational constraint. Abstract pattern recognition is key to the endeavor.

Similarly, good programmers have strong pattern recognition skills. They can identify redundant code and invoke the DRY ("don't repeat yourself") principle, and they can encapsulate the redundancy into a single reusable function or component. That encapsulation is a description of the abstract pattern.

Architects do the same thing with design patterns. Experienced architects look at an application and identify underlying abstract patterns to reuse. They see redundancies and, hence, can identify the patterns within.

Putting it all together: Pattern recognition skills aid musicians and coders

A pattern recognition ability is essential to create software that is efficient and reusable. However, one is not born with the ability to work with abstract patterns; this skill is developed over time. Start with simple patterns, such as code redundancy, and then work your way to more advanced patterns found in system architectures.

The trick to develop the ability to discern abstract patterns is to build up software development experience. For example, the command query responsibility segregation (CQRS) pattern was not a stroke of inspiration from a single architect. Rather, a number of architects created a lot of enterprise software that separated data write behavior from read behavior before the pattern emerged. Eventually, the architects saw the pattern and described it as an abstraction that's useful to others.

Abstract patterns are a key element to create efficient and reusable software. It takes time and repetition for abstract patterns to appear. Few people understand the concept right off the bat, but once you've mastered the skill, you'll dramatically increase your ability to imagine and execute complex ideas -- whether in software or in music.

Dig Deeper on Professional skills development and career advice