informa
/
Commentary

Object-oriented music

I've been an amateur musician most of my life, and I've been playing more music recently than usual.  Perhaps for that reason, it has struck me that the way musicians think about music is much like the way object-oriented programmers think about object-oriented programming.

I've been an amateur musician most of my life, and I've been playing more music recently than usual.  Perhaps for that reason, it has struck me that the way musicians think about music is much like the way object-oriented programmers think about object-oriented programming.

Consider: Object-oriented programming is programming with abstraction, inheritance, and dynamic binding.  To see that each of these notions has a musical analogy, consider the idea of the scherzo movement of a symphony.

The notions of "symphony" and "movement" are both abstractions, similar to the notions of "vector" or "queue."  A symphony is an extended piece of orchestral music, normally comprising several movements, which are shorter pieces in the same or related keys.  A scherzo is a kind of movement (inheritance), usually in a dance form (inheritance), with witty or humorous qualities (multiple inheritance, or interface side conditions).  And if we talk about, say, a typical structure for the scherzo movement of a symphony, without mentioning a particular symphony, we are engaging in dynamic binding.

 So it seems to me that the kinds of abstractions that we use as programmers are surprisingly similar to those that musicians use.

 Now that I've become aware of this similarity, other examples have been popping up.  I'll talk about more of them later.