Its not the same in terms of its incrementality. Generally a beat or a melody for one track wont really work for another, but it can. I don't think parts of music can be encapsulated. Still I find making music similar to coding in terms of creativity.
I think in all creative pursuits you can get very very good by consistently seeking to do better and gaining insight into what you do. If you're always thinking about the next layer of meaning and trying to stretch you'll achieve great things.
I guess it depends on what you mean by encapsulation. If you're writing music with functional harmony, it's a very useful concept, although you typically work in reverse.
The encapsulated idea might be the dominant part of a V-I cadence, which you can replace with an extended, embellished pattern that has basically the same function but is much more interesting. V->[I-ii-iii-IV-V/V-V]
I-vi-ii-V-I
I-vi-ii-[I-ii-iii-IV-V/V-V]-I
And maybe at the beginning, you can reinforce the tonality with a little pattern instead of just plunking out a I. So I->[I-vii-I]. Then you have a progression like this:
[I-vii-I]-vi-ii-[I-ii-iii-IV-V/V-V]-I
Then, you can map that pattern onto a rhythmic framework. Maybe with a generalized mapping function that you could use for a number of different patterns. Anyway I'm rambling now. Maybe I'll blog about it at some point.
(note that the vii should really be vii-diminished. The forum doesn't appear to support the little circle superscript.)
Ok more good examples of a sort of encapsulation in music. In general all I meant was that writing parts of music for the purpose of reuse would generally be considered to lessen the musical quality because of the lack of originality.
slightly off topic, but I think a beat or melody CAN be generally interchangeable if it's done right and with interchangeability in mind. See here: http://micropledge.com/projects/music-mash
Yeah I don't disagree despite what I wrote. Perhaps it's better put that interchangeability is a very powerful thing in software, but its more of a gimmick in music where no component takes nearly as long to describe and making parts that work independently is not seen as a good thing. The chords and tonal systems ensure interoperability anyway.
I think in all creative pursuits you can get very very good by consistently seeking to do better and gaining insight into what you do. If you're always thinking about the next layer of meaning and trying to stretch you'll achieve great things.
I just made the comparison in this blog post which hasn't garnered much yc interest: http://greendestinyonyc.blogspot.com/2007/08/creativity.html