I have always been fascinated by the parallels between music composition and computer programming. It has been said many times that someone who is skilled in the former will have an aptitude for the latter (although it apparently doesn't work the other way around), and there is some basis for this. In both cases, the creator of the work/program comes up with an idea, works out how it will be implemented, then fills in the details. When the end result is completed, it can be "run" to see if it meets the creators intentions. If not, the creator can go back and fix the "bugs".
In both cases, the creator can make mistakes that prevent the end result from being run at all. In "computerese" this would be a syntax error not recognized by the compiler, while in music it would be a demand from the composer that a flute play a low "F" or a timpani play a chromatic scale legato. In other cases, there may be a mistake that merely sours the end result. The orchestra playing a new composition will obediently play what the composer has written, regardless of whether it was intended. In a like manner, a computer will follow to the letter the instructions given by the programmer, unable to make judgements about whether they match the programmer's intentions or whether they will produce "garbage" on the screen.
Recently, while taking classes on object oriented programming, I have discovered a new parallel between composition and programming. Object oriented programming refers to a relatively new method of thinking programming problems through by breaking them down into manageable chunks. In the early days, programmers attacked a problem sequentially, from beginning to end, telling the computer which tasks had to be completed in which order to get the desired result. As programs became increasingly complex, this procedure oriented programming became more and more cumbersome to use, and often would produce a "user-hostile" result. Then, in the late seventies, object oriented programming made an appearance.
In object oriented programming, different operations would be broken down into interchangeable and reusable modules that could be called into play at the programmer's discretion (or, in some cases, even the user's discretion) to solve the programming problem. Although in many cases the end result was not that different from procedure oriented programming, it was the new way of thinking that allowed more complex and more powerful programs to be written more easily.
In learning all this, I realized that there was a musical parallel to this computer revolution--the Viennese Classical era. Prior to this era, composer rarely used formal structures except in fairly simple and short compositions, such as the "da capo" arias of the Baroque era (following the "A-B-A" formula, where "A" and "B" represent musical ideas), and the five-part rondo ("A-B-A-C-A" form). The really big works were either made up of many smaller pieces (in the case of suites), or were rhapsodic in nature (concertos and fugues), the musical equivalent of procedure oriented programming. The composer basically created the structure as he went along. There was often a recapitulation of sorts (a return of the main theme in the home key), but this was often more a matter of necessity than formal structure. Many instruments, such as brass and timpani, could only play in the home key, so a return to the main theme involving all the instruments would have to be in this key.
The beginning of the Viennese Classical era in 1750 (the year of J.S. Bach's death) brought many changes to music. The brass instruments were tamed and brought down lower in their range, reduced to providing support to the other instruments. The intricate polyphony of the Baroque era was shunned in favor of the homophonic approach, with a single melody in one or two instruments supported by harmony in the other instruments. In general, the music became more reserved and less emotional. The most significant change, however, involved structure.
No longer would composers go from beginning to end with no set plan. Now, the composition of a large-scale work (such as a symphony) would follow one of a number of strict formulas. This had several benefits to composers: It made composition easier, since the composer knew the basic structure to follow before he started, and it allowed for more complex works that could be followed by the listener who would become intimately familiar with the new structures over time. Basically, the problem of composing a large-scale work was broken down into manageable chunks. In the first movement of a symphony, for instance, a composer had to come up with a primary theme in the home key, a subordinate theme in a new key, and some method of moving from one to the other. He would have to compose a rhapsodic development section using material from one or both of the two themes, and he would have to come up with a way to end the work, also by using existing thematic material. He then put it all together like this:
First theme :: Transition :: Second theme in new key :: Development :: Recapitulation (repeat of first theme) :: Second theme in home key :: Coda.
This structure, known as the sonata-allegro form, practically wrote itself. It was the foundation of the symphony throughout the eighteenth and nineteenth centuries. The sonata-allegro form was modular in construction, allowing for thematic material to be reused with minor changes in key and orchestration. For a small investment in thematic material, the composer could create an engaging fifteen minutes of music.
At first, symphonies were fairly short and simple, but over the years became longer and increasingly complex, without ever altering the original structures on which they were based. Symphonies took a huge leap forward with Beethoven in the early nineteenth century. He took each of the commonly used modules and expanded them, adding instruments to the orchestra in the process. His crowning achievement was the Ninth Symphony, which takes over an hour to perform and yet enthralls the listener from beginning to end.
Although strict formulas have since been abandoned by composers of serious music because they are too predictable, modern composers nevertheless continue to adhere (for the most part) to the principles of modular composition, the musical equivalent of object oriented programming. This mental discipline continues to produce music of intriguing complexity with a minimum of effort on the part of the composer.