|
|
|
 |
 |
 |
|
Home > APCS: Role-Playing in the Classroom
|
APCS: Role-Playing in the Classroom
|
|
|  |
by DavidLevine
St. Bonaventure University St. Bonaventure, New York
 |
|
|  | Tracing code is certainly one way to understand software, but my experience is that the use of scripted role-playing exercises can help students build intuition about software concepts -- or about large systems such as MBCS -- in a manner that is engaging, memorable, and often fun.
Teaching Algorithms in the Past
Years ago, when I was teaching computer science for the first time, I always began my introductory courses by having the students write algorithms for common tasks; one of my favorites was "How to Make a Peanut Butter and Jelly Sandwich." After the students wrote their algorithms, I brought in a confederate who proceeded to follow their "scripts" quite literally. The results were messy, but graphic and memorable. Over time, however, I stopped doing this exercise. I don't recall why; it just seemed to happen.
Using Scripts to Understand Classes
Several years later, when I was struggling with teaching my students the difference between objects and classes, it occurred to me to bring back this type of exercise, but with a twist. Instead of the students writing the script and the teacher acting it out, we would try it the other way around. I would write the script and ask the students to act it out. I wrote scripts for a few simple classes such as Acrobat (which can do KneeBends and HandClaps as well as tell you how many it has done) and Blackboard (which can respond to requests to draw at the blackboard). Using these scripts, I was able to illustrate many aspects of object-oriented programming, including the communication of parameters and return values during method invocation, the idea of private data, and the notion that each object kept track of its own state independent of the class. (The latter concept may not be true in general, but it is true in all of my role-playing examples.) I found that I began to use the scripts earlier and earlier in my course -- to the point where I now use them on the first day! Getting the students out of their seats from Day One certainly sets a tone for the rest of the semester.
Role-Playing and MBCS
Two years ago, I received my first copy of the Marine Biology Case Study (MBCS). As an AP reader, I had graded "the case study question" every year, and I had taught BigInt in my courses, but I was nonetheless caught off-guard by the sheer scope of MBCS. I could see great potential in this wonderful system of intercommunicating objects, but how could a student (or even I) quickly gain an intuitive grasp of what was going on? The idea of using a role-playing scenario took form, so my colleague and fellow APCS reader Steve Andrianoff and I tried the idea out with our first set of Case Study Workshop attendees. It was interesting, but we erred by staying too close to the code, and the result was a "play" that was almost too confusing to understand. So we simplified and revised and repeated several more times. We now have a set of scripts that we use to introduce students and high school teachers alike to MBCS. The current version of the MBCS role-play has been used by over 250 teachers and students (that we know about!). Depending upon your pacing, it can take between 40 and 90 minutes to run through, but after completion, students appreciate the lack of centralized control in an object-oriented system, and they have a solid understanding of how the various classes (particularly the Environment and the Fish) interact. Furthermore, the experience is a great touchstone throughout the year.
Java and Role-Playing
More recently, at St. Bonaventure University, we switched our introductory language to Java. This means that we now introduce the idea of inheritance into the classroom as well. Once again, we have created a set of scripts that simulate a simple program that makes use of inheritance. This program plays a game of Chips -- a Nim-like game in which players take turns removing chips from a pile, attempting to take the last chip. There are various Player classes that inherit aspects from more general classes. The scripts give the students an understanding of the ideas of method dispatch and of how run-time type inference works.
Complete scripts for the exercises mentioned are available in "See also," below.
|
|
|
|
|
|