Pedagogical Pattern #31
Audio Object Analogies Pattern

(Version 1.0)
Robert Biddle
Victoria University of Wellington
New Zealand
robert@mcs.vuw.ac.nz

Goal:

To help explain object design principles by means of a consistent set of analogies from audio system design to object-oriented design.

Audience:

This resource is intended especially for students without any programming experience. However, it has also proven useful for more experienced students as well.

Pre-Requisites:

None. This idea specifically relates to students who have little or no programming experience.

Motivation:

Students learning programming for the first time have difficulty in learning design because they lack experience with the effects of good or bad program design. To address this lack of experience, we propose harnessing experience from another domain. The domain we suggest is audio systems, meaning CD players, tape-recorders, speakers, headphones, and so on. Most students have experience with these systems, and are able to understand the implications of various designs. We establish analogies from principles of audio system design to principles of OOD, and then recall them when discussing specific object designs.

Applicability:

The basic idea of analogies is to help explaining an unfamiliar subject domain in terms of a familiar sample domain. This is a strong approach where the students are indeed familiar with the sample domain, and where the two domains do in fact correspond sufficiently well for explanations in the sample domain to provide illumination in the subject domain.

This firstly means that the audio analogies do require that students be familiar with audio components. This is very common, mostly because listening to music is a popular cultural activity, and so audio components are commonplace. Moreover, the analogy works with audio components from the viewpoint of a user of the components, and not detailed knowledge of audio technology is required. However, there may be students who are not sufficiently familiar with audio components, and for these students the analogy will not be helpful.

The correspondence between the audio component domain and object-oriented programming is strong enough to be useful, but like any analogy it is not perfect. The analogy works well for classes, objects, interfaces, encapsulation, and composition. It also works, though not as smoothly, for inheritance and polymorphism. The analogy begins to break down with regard to parameters and customisation, although useful points can still be made. There are difficulties in making sensible correspondences regarding the system flow: the object-oriented domain is typically seen as control-flow oriented, and the audio-system domain seems more suited to a data-flow orientation.

Structure:

The analogy is really a quite general idea, rather than a specific item. Moreover, it has no concrete aspect: there are no software components. There could be a set of model diagrams or transparency masters, but none are provided currently. The only current artifact is the paper "Explaining Issues in Software Reusability" cited below, which discusses the analogy in detail. Some of the key elements of the analogy are as follows:

Objects: Object identification concerns understanding the nature of an entity with an interface and behaviour. Entities in the audio component domain are easy to understand as they can usually be shown to physically separate, have an understood interface, and a known behaviour.

Classes: In discussing audio objects, different classes of objects can also be easily identified because of mass production of particular components, and interchangeability of kinds of components on the basis of behaviour. Moreover, this can then lead to a discuss of taxonomy, and what interchangeability really might mean.

Interfaces: The interfaces of audio components can either be human interfaces or inter-component interfaces. The human interface, switches, dials, and so on, can be used to explain the nature of an interface, where control of behaviour is facilitated in a limited way. More importantly, the inter-component interfaces can then be introduced in a similar way, describing plugs and matching sockets, tabs and tab-detectors, and so on, and explaining how these also facilitate control of behaviour in a limited way.

Encapsulation: The human interface of audio components allows an easy explanation of encapsulation, as audio components are usually physically encapsulated, except for the provided interface. It can be shown how this allows component integrity to be maintained, and implementation to be modified without modification of the interface or other components. This argument can then also be made for inter-component interfaces.

Composition: While audio components are typically encapsulated, they can physically be opened, voiding the assurances of encapsulation. However, this does allow the internal implementation to be understood, which typically consists of other components, such as transformers, processor chips and so on. The point can be made that such inner components can be used in various different audio components, and that a particular audio component is an encapsulated composition of a set of connected inner components.

Inheritance: The range of audio components can be detailed taxonomically, which might provide a first approach to explaining inheritance. But the real advantage of inheritance in practical programming concerns good understanding of the principles of component interfaces. Inter-component interfaces allow components to be connected in a useful but safe way, typically by the shape of plugs and sockets representing deeper internal dependencies. However, in some cases a new plug can conform to the shape of an existing plug, yet provide different behaviour, a stereo headphone plug conforming to the shape of a monaural headphone plug, for example. In this way, interface conformance leads to greater utility for the context component, such as a tuner, which can be listened to in stereo or monaural sound. Interface conformance is the essence of inheritance as subtyping, which is the real advantage of inheritance.

Consequences:

Use of this approach makes it easier to explain object design principles to students who have no experience with program design, or the consequences of good and bad program design. They usually do have experience in using audio components, and can understand the consequences of good and bad design in that domain. The audio component design domain corresponds sufficiently well to the object oriented design domain that the students are then able to better appreciate issues in program design because of the analogy.

Implementation:

The analogy is useful when explaining several detail principles of object oriented design, and useful both in explaining the design principles in the abstract, when they are being introduced as a general concept, and also when discussing specific design issues.

When introducing a design principle in the abstract, the audio component domain can provide a concrete example with understandable implications, at a time too early for the students to really appreciate examples relating to program design. In this way the analogy helps introduce general principles by means of a specific example, at a time that would otherwise make a specific example problematic.

When later discussing a specific design issue, the students might still have insufficient experience to understand the consequences of various design decisions. Such students, quite reasonably, can be unhappy or unwilling to simply trust authority to dictate that certain designs are good or bad, and unable to determine the correct conclusion by themselves. The audio analogy has the benefit of providing concrete examples with understandable implications backed by student experience, rather than relying on acceptance of authority or understanding of principle. For example, to help a student understand why a particular design is poor, a similar design can be sketched out in the audio component domain, where the student will better see how the poor design leads to undesirable results.

Related Resources:

The author does not know of any resources that are especially related to this idea. However, anyone knowing of material with a similar approach is invited to contact the author, who will be pleased to investigate and possibly provide references here.

Example Instances:

A favourite example of the utility of the analogy concerns a perennial student design decision. Every year, students design many classes with methods that must make some decision and report the result. Every year, some students print out the result, rather than returning it. Every year, these students resist the idea that returning a result is superior design, because in the instance they are considering, printing out the result is exactly what they want. However, we have had success in asking if they would consider purchasing a cassette player that came only with permanently attached headphones, or permanently attached speakers, or a permanently attached cassette! We make the point that indeed in some circumstances these might, surprisingly, indeed be justifiable. However, they must consider the consequences of design in light of reasoning on such a basis, considering future reusability as a key way of making design decisions.


Home Project
Leaders
Pedagogical Pattern
Format
Evolution of a
pedagogical pattern
Sample
Patterns
Publications
Subject
Index
Learning Obj.
Index
Teaching/Learning
Element Index
Alphabetical
Index
Author(s)
Index
Contact
Us
Previous pattern Search This Site Next pattern