Algorithmic Composition: A Gentle Introduction to Music Composition Using Common LISP and Common Music
Skip other details (including permanent urls, DOI, citation information) :This work is protected by copyright and may be linked to without seeking permission. Permission must be received for subsequent distribution in print or electronically. Please contact : [email protected] for more information.
For more information, read Michigan Publishing's access and usage policy.
4.1 Object Hierarchy
Many things we encounter in everyday life are organized hierarchically. Consider traditional musical instruments . We can group musical instruments into three sections: strings , winds , and percussion . The winds section is comprised of woodwinds and brass . The wind instruments are grouped as a family because each member of the family produces sound by blowing air through a tube. Woodwind instruments include the clarinet, flute and oboe. Brass instruments include the trumpet, French horn, and tuba. Wind instruments may be described as a class of musical instruments.
In an object-oriented model, the relationship between objects in the hierarchy is described as either superclass or subclass . A superclass is an object one-level higher in the hierarchy than an object and a subclass is an object one-level below. Notice in Figure 4.1, instruments is a superclass of winds and trumpet , horn , and tuba are subclasses of brass . The connection between a superclass and its subclass is called an inheritance link . The subclass inherits attributes, referred to as slots , from its superclass.
Figure 4.1.1
We can further refine our instruments hierarchy by adding particular objects referred to as instances of an object. For example, if I play tuba in an ensemble, I could refer to my tuba as the object my-tuba . my-tuba is a particular instance of the class tuba . my-tuba has all of the attributes of the class tuba that it inherits from the brass superclass.
The way I perform my-tuba is different from the way someone plays a trumpet . Even though my-tuba and trumpet inherit from brass , there are differences in the method of performance.