[Grace-core] Animations in Grace

Lex Spoon lex at lexspoon.org
Sat Aug 31 15:14:55 PDT 2013


I think James is onto something about the stepping model versus
threading. Better be careful what examples you pick!

As an argument in favor of stepping, it is a more robust way to write
professional software later on. Practically all GUI code is written in
terms of a single thread and a panoply of callback mechanisms, and
IMHO there is good reason for that. Your pain in developing new
examples will not be in vain!

I taught a few young people to program things in Squeak's EToys, which
uses the stepping model. Here are a few notes from that.

A really important primitive that Alan Kay insisted is easy to access
is "repeat on every tick". Does Grace have such a thing? In EToys,
it's the default: if you drop an instruction on the playing field, it
starts running. By having "repeat on every tick" easily available, you
get to put off teaching students about loops, which many people report
is a stumbling block for new programmers.

In thinking about examples, here are a few that work well in EToys:

- Simulation of moving objects, like basketballs in the example Kim
mentions. You can move something in a straight line by adding a delta
to the position on every tick. You can make it fall under the effect
of gravity by adding a delta to the delta every tick.

- Steering. If the graphics libraries has each widget have a
"heading", then you can provide methods for moving forward and for
turning left or right. Given that, it's really easy to connect one
widget to another and let people drive a car -- I've taught dozens of
little kids how to do that one. You can then make it more elaborate,
for example having the car steer itself when it realizes it is going
off the road.

- Simulations on a grid, as in StarLogo. For example, it is not
complicated to simulate ants with 2-3 kinds of pheromones to get them
finding food and bringing it back to the lair.

Another trick that Alan emphasizes is letting students be artistic
with the objects they are using in the simulation. Don't make them
build using squares and circles. Let them import and use clip art, and
it will dramatically improve their engagement.

Just a few thoughts. I'm sure it is exciting to have a Grace class coming up!

Lex


More information about the Grace-core mailing list