Program visualization and animation has traditionally been done at the level of the programming language and its implementation in a computer. For example, variables have been visualized as boxes (representing memory locations), and nested function calls as a stack of frames containing parameters and local variables (representing the call stack implementation in many computer architectures). In object-oriented (OO) context, animation has also been based on UML diagrams that reveal connections between objects and classes and thus represent another level, i.e., relationships between components of an individual program.
Novices have problems in learning the very basic OO concepts which results in misconceptions leading to either erroneous or suboptimal programming skill. Program visualization and animation are supposed to enhance learning and prevent misconceptions but the visualizations should be informative and at the same level as the concepts to be learned. Thus visualizations that build upon programming language implementation or uninformative graphical notation may easily fail in helping novices to learn programming concepts.
Metaphor involves the presentation of a new idea—the so called target—in terms of a more familiar and usually more concrete one, the source. In contrast to analogy, metaphor is not an exact counterpart but differs from the target usually both in form and in content. Critical to the power of metaphor is that the relation between the source and the target must involve some transformation, hence people have to actively construct the relationships that comprise the metaphor. Salient dissimilarities of the source and the target—in the context of salient similarities—stimulate thought and can facilitate active learning.
The OO metaphors apply a metaphor approach to object-oriented programming. The ultimate goal is to provide novices with metaphors that will help them in learning basic OO concepts. For this purpose, new metaphors are presented for class, object, object instantiation, method invocation, parameter passing, object reference, and garbage collection. The metaphors are designed to grasp the basic ideas of object-oriented programming; they do not rely on implementation issues or diagramming techniques designed for expert use. Thus the metaphors provide novices with visually rich visualizations that can develop and consolidate a valid mental model of object-orientation.
The effects of metaphors have been found to be positive in complex learning situations whereas their effects in simple tasks (retention or rote learning) has been found to be minimal. As programming is a very complex task, one can expect positive effects. Indeed, earlier experiments have indicated a strong effect of metaphors and animation on students' capabilities to use variables in imperative programming. Classes, objects, methods and other OO constructs are even much more complex concepts, and the use of these OO constructs leads to much more complex programming situations than the use of variables and simple control structures. Thus, metaphors can be expected to have a positive effect not only on simple programming but on the learning of OO concepts, also.
The OO metaphors are meant to be used in OO programming courses during lectures and in teaching materials. Some textbooks have already used the blueprint metaphor in this manner: the metaphor is explicitly introduced together with the notion of classes, and it is thereafter used repeatedly in order to consolidate the metaphor in students' mental representation of OO programming. Similarly, e.g., the workshop metaphor for methods should be introduced with the notion of method and it should be used repeatedly when a teacher draws illustrations on blackboard. When a metaphor is introduced for the first time, the teacher should explain what are the main similarities and dissimilarities between the metaphor and the associated OO concept. The illustrations drawn by the teacher need not be accurate replications of the pictures used in the animator, but having a (partial) screenshot from the animator in lecture notes will make the connection clear to students.
Furthermore, there are six animations of carefully selected OO programs that can be used in lab sessions. We recommend that each animation is presented to students as follows:
The animations can be found here. Each animation should be presented after the appropriate concepts have been treated in lectures.
The animations use role images for variables. We suggest that roles of variables are first introduced with their role metaphors, perhaps using the PlanAni program animator.
The animations are not supposed to be used as the only programming environment in an introductory programming course. Instead, we do suggest the use of common programming environments for normal programming tasks, and the use of metaphor-based animation for the few, carefully selected programs only.
Last updated: September 7, 2007