OO Metaphors Home Page
Metaphor-Based Animations of OO Programs
This page contains six animations that use OO metaphors to visualize
OO concepts. For each animation, the program code as well as an
English and Finnish version of the animation are given. For
presentation purposes, some of the animations restrict user input,
e.g, so that only a small number of objects can be created even
though the program code does not have such limitations.
The programs use a simple console input class Input that can be found
here.
We suggest that each animation is used with students as follows:
- The teacher explains what the program does from a user's perspective: its input and output.
- The teacher runs the program (in the standard Java environment; not in the animator) with selected input.
- The students run the program (in the standard Java environment; not in the animator) with their own inputs.
- The program code is given to the students as paper hand-outs.
- The teacher introduces the overall structure of the program to the students: classes,
methods, and the actions of the main method.
- The teacher animates the program with selected input.
- The students animate the program with input given by the teacher.
- The students animate the program with their own input.
During animation:
- pop-up boxes must be acknowledged with a mouse click or with hitting Enter or space,
- if an animation asks for user input, the input field above the input plate must first be
activated with a mouse click.
The Animations
Basic OO Concepts:
The first animation that introduces the concepts of class, object, member variable,
constructor, method, static method main, parameter, return
value, object reference, and the idea of garbage collection.
Revisiting Strings:
A short example demonstrating that Strings are objects.
Program
Animation/English
Animation/Finnish
Arrays:
Introduces arrays (containing integers), how to increase array size,
local variables (both at method level and "for (int i=0;...")), and garbage collection.
Subclasses and inheritance:
Simple subclasses, inheritance, overriding, super, polymorphism. Uses the Java ArrayList
class.
Class variables:
Class variable and class method in a program that would be more complex if implemented
without these concepts.
Recursion:
Abstract class having two subclasses with a method that is recursive
in the other subclass and non-recursive in the other.
Program
Animation/English
Animation/Finnish
Last updated: September 7, 2007
saja.fi@gmail.com