[plt-scheme] Re: animation projects, video-game and not
> On Thu, Feb 5, 2009 at 1:01 PM, Arthur Nunes-Harwit
> <anh at cs.rit.edu> wrote:
>> Hi,
>>
>> I see a lot of projects that are video games. Such projects
>> ultimately rely
>> input and output, or side effects (perhaps disguised via monads).
>> The coding
>> style for much of HtDP is purely functional. What is the pedagogical
>> impact? Do the students notice? (As a student, I didn't notice
>> right away
>> that read was different from square.) Is there any discussion of
>> "special"
>> functions or objects?
>>
>> What is the impact of other languages such as Java where the
>> assumption
>> [built into the language libraries] is that everything is done
>> using side
>> effects? To what extent is it still possible to take a mostly
>> functional
>> approach?
Matthias, Robby, etc. have suggested some readings. You might also
take a look at (the January draft of) my textbook, which emphasizes
world-based animation throughout. No explicit mention of input;
instead, students write event handlers for mouse, keyboard, and timer
events (just as in Java GUI-based programs). No explicit mention of
output; instead, students write event handlers for redraw events
(somewhat as in Java GUI-based programs; the main difference is that
the event handler _returns_ an image rather than _modifying_ an
image). No explicit mention of state or side effects; this differs
from the usual practice in Java-based GUI's, but the designers of the
Java class libraries _could_ have done it this way.
In fact, I'm sure one could write a functional front end for much of
the Java GUI libraries, giving it an API analogous to DrScheme's
world or universe teachpacks.
Let's see... what non-video-game animations do I have? The following
are really easy examples, the sort that students in my "programming
for non-majors" course would be doing before mid-semester.
* Write an animation of a parametric equation, e.g. x= 100+50cos(t/
10), y=100+30sin(t/10), which traces an ellipse; changing the
constants allows you to do some fun and easy mathematical experiments.
* Another easy, early example is simply following the mouse with a
specified image; this is what's happening inside your computer all
the time with a visible cursor.
* Another easy, early example is a progress bar, as one sees all the
time in real operating systems.
* There's an exercise to allow a user to "type" into a text field. A
later version adds support for delete, left and right arrow keys.
* A digital clock. Later, an analogue clock.
* Slide shows.
* E-commerce: choose from a menu of items and see a picture of it.
I haven't done as much work on coming up with substantial projects,
like the video-game examples others have posted; I need more of those
in the book :-)
Stephen Bloch
sbloch at adelphi.edu