[plt-scheme] 2htdp/image questions

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Thu Apr 22 16:50:02 EDT 2010

On Apr 22, 2010, at 3:55 PM, Marco Morazan wrote:

> May I suggest that this is not a good idea? It breaks the abstraction
> that the HtDP languages and universe provide which makes the teaching
> of programming to beginners possible. The introduction of something
> like cache-image all of the sudden means that not all images are
> alike. The _beginner_ must now think about the machinery that renders
> images in addition to thinking about the problem/game they are working
> on. IMHO, that is not the way to go.

What part of "I wouldn't teach this in a beginning course" didn't get through? :-)  The "cache-image" proposal is purely an optimization tool, not to be used until you've got a program that produces correct answers but too slowly.  Most of my beginning students will never write an animation that complex, so they'll never need it.

I initially suggested it as a way to make build-image reasonably efficient, so I could provide students a beginner-friendly way to write nontrivial bitmap computations.  Paul then requested basically the same thing for the benefit of a student who's doing a more-than-usually-complex animation project.

I don't want to spend a lot of neuron cycles on "thinking about the machine", but this struck me as a way to get a lot of efficiency improvement for minimal conceptual cost -- and none at all for my students.  And the API really would be pretty simple: whenever I build a complex image that I know won't change very often, I wrap a "(cache-image ...)" around it and then forget about it.  Every function that worked on it before should still work, but some of them will work faster.

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.