Generalizable example

A colleague and I were discussing programming examples that we give to our beginning students, to get them motivated. Of course you want to provide a first example that is reasonably simple, so that students can quickly get to that “aha” moment. But you don’t want it to be too simple.

Suppose, for example, you are teaching computer graphics, and your first example is drawing a square. You show them a little computer program that’s just a few lines long and say “see, here is all you need to do to draw a square!”

Ideally you have provided an example program that not only draws a square, but can also be modified in various ways to draw a rectangle, etc.

But then suppose some student asks: “What if I want to rotate my square by 10 degrees?” Too often the answer is: “Then you need to forget everything I just showed you. To make a square that can rotate, you’ll need something more complicated.”

That’s a failure mode. It means that the first program you showed them was too simple. You worked so hard to provide an accessible example, that you ended up with one that could not be generalized.

I’m not saying that providing an example for students that is simple yet generalizable is easy. It is not. But it’s worth striving for, because the generalizable example is much more interesting and enlightening for them than the simplest possible example.

One thought on “Generalizable example”

  1. When I was a student I was frustrated by template coding assignments. I felt like an artist who was being trained by paint by numbers. Part of the problem is not just learning the concept the assignment is training you on but also figuring out all of the context that the template provides – ie how did the teacher intend for you to fill out the code? That may not be the way I had in my head, or even the best way. I would have preferred if the template had been a library for which I write the structure (which is closer to work you typically do as a programmer) instead of a fill in the blank.

Leave a Reply

Your email address will not be published. Required fields are marked *