Alice 2 and Alice 3 have code blocks called “do in order” and “do together.” They call these control structures, although usually programming languages have control structures like “if” and “while.” Instructions placed in a do in order block are executed one after the other. Each instruction has to wait until the one before it finishes before it can start. On the other hand, instructions placed in a do together block are executed simultaneously. All the instructions start at the same time, and the block itself is finished when the longest instruction inside finishes.
This is what I tell my students, but when asked to regurgitate this fact, some students instead say that “do in order” makes the animation choppy, while “do together” makes it smoother. For years I have marked this wrong, saying it has nothing to do with smoothness of animation. These are control structures; they are about how the instructions inside are executed. However, I think I figured out what they were thinking. Imagine you have to reach for something. Your elbow joint and shoulder joint both have to move to reach it, and you move them both together for a smooth movement. If you were to move your elbow joint by itself, and then your shoulder joint by itself, you may still reach your target, but the movement will look robotic and choppy. Therefore, “do together” allows for smoother animation.
Why does “do in order” look choppy and robotic? Robots are controlled by computer programs, and traditionally computer programs execute one instruction at a time. Doing one thing after the other is, in the imagination, exactly what computers do. It is what they do, except when they’re running in parallel.
But is “do together” really a great introduction to parallel programming? When programmers implement parallel algorithms, do they really think in a “do together” semantic? I’m not convinced.
Leave a Reply