Selected Teaching Samples: Animations, Visual Metaphors, and Interactive Examples

KTR insignia - K, T, R superimposed

Karl Toby Rosenberg

Contact: karltobyrosenberg [-at-] nyu [-dot-] edu

Home Page

Interactive-Flood-Fill (interactive computer graphics)

I try to motivate concepts by building interactive, playable visual artifacts. This is a flood-fill algorithm visualization that works with an actual animation system that can be paused, fast-forwarded, and reset by live-coding as the program is running. In this case, I can change the starting position of the grid.

Piet Mondrian-Inspired Conditional Statements (interactive computer graphics)

Zooming Recursive Count-down (hand-drawn animation)

This visualization for a recursive count-down zoom is something I intend to narrate over in steps to show how as we go deeper into the recursive algorithm, the substructure looks identical as before, but with different data every step as the problem is brokendown. The stop sign is a metaphor for representing the base case as a literal stopping point. I like creating these more playful examples to provide something more memorable and spatial when exploring concepts for the first time before going into specific algorithms or code.

I took inspiration from Piet Mondrian's paintings to create an exercise in which students must create conditional structures around the dimensions of rectangles, and check whether the mouse cursor overlaps specific ranges to decide whether to fill a rectangle black. I can also use a version of this example to illustrate recursion.

Code as Flow+Data Walk (hand-drawn animation)

I like to explain code as a walk along a path, with parallel visualizations for the flow/journey and the corresponding data behind the scenes

Conditional Branches as Branching Train Tracks (hand-drawn animation)

We can think of conditional branches as routes along a branching railroad track

Error-handling as Trampolines to Safety (hand-drawn animation)

We can think of error-handling as creating a trampoline beneath a perilous code path, to give the program flow towards a safe way out

Quest to Defeat the Dragon (hand-drawn)

Students need to interpret this drawing to create a conditional structure that checks random variables to decide whether the hero can make it through the quest to defeat the dragon or not. I like giving examples that require taking a visual scenario and figuring-out how to express it in code.

Functions and Cakes (hand-drawn animation)

Functions are like configurable ovens that let you bake cakes.

Illustrating 2D Coordinate Grid Iteration (hand-drawn animation)

Walking through how to iterate over a 2D grid