Assignments that teach Polymorphism

In object oriented languages like Java, there are several types of Polymorphism to consider.

Overloaded Methods

The Finch API actually has several basic overloaded methods:  setWheelVelocities and playTone are both overloaded in that they can take either two or three arguments.   

Overwritten Methods

Students can create sub-classes of the Finch class and then overwrite the functionality of methods in the class.  For example, a student might overwrite the setWheelVelocities method for one that only moves forward if no obstacle is detected. 

Dynamic Method Binding

This is the trickiest type of polymorphism to demonstrate as it requires a code base including one abstract or interface class and a number of specific implementations of that class.  One could imagine creating abstract classes for either the sensors or outputs on the Finch, and then instantiating specific sub-classes for the different sensors and outputs.  The super-class would need abstract methods, like "sense" for the sensors, and "act" for the outputs.