The Pong Lab presents a scenario in which beginning CS students take on the role of programmers within the context of a larger software development project. This software development project, under the auspices of the fictitious Object-Oriented Language Development Company (OLD Co.), asks students to develop and test several simple classes to complete a variant of the classic game of Pong. The figure below shows a screen shot of the game:
The setup for the assignment as presented to the students is as follows:
The high-paid software engineers at OLD Co. have spent years designing the Pong program. They have identified the classes that describe the objects the program will use. They have carefully defined the public interfaces of each of the objects. The specifications for these classes were handed off to the programmers who completed the majority of the implementation. However, just before the project was completed, all of the programmers were offered huge salaries by start-up dot com companies and simply quit on the spot! In exchange for a big check I agreed to write these classes for OLD Co. But, being ever the educator, I decided that writing and testing these classes would be a good experience for you. Of course, I keep the check from OLD Co!
Noting that the project was mostly completed, the students are given a collection of
.class files which when executed display the game as shown above. However, due to the missing classes the ball and paddles do not move and the player's scores do not work. In addition to this collection of
.class files the students are given JavaDoc specifications for the three classes which were never completed. These classes are
PongBall class represents the ball and updates its position and velocity as it bounces around the screen. The
PongPaddle class represents a paddle and controls its position and movement. The
PongScore class represents a player's score and keeps track of the number of points the player has scored.
The students are asked to implement and test each of the three missing classes. As they implement each class they simultaneously develop a simple test program which creates and exercises objects of that class. When a class has been completed and verified its
.class file can be added to the Pong game and its effect observed. For example, once the
PongBall class is completed the ball in the Pong game will move, while the paddles and scores are still non-functional.
The Pong Lab is appropriate for an objects-first CS1 course in which the development of classes with instance data and methods precedes the introduction of control structures. Specifically, the Pong Lab was developed to accompany the material in the third chapter of "Computing Concepts with Java 2 Essentials, 2nd edition" by Cay Horstman.
The Pong lab is a "conservatively radical" assignment and thus exhibits the positive attributes of such assignments (Regis, 2000). In addition to those attributes I like the Pong Lab because:
mainmethod which creates and exercises the classes.)