Archive

A magical way to learn computer science

Former FXPAL intern Jeremy Kubica’s Computational Fairy Tales is a fresh new entry into the blogosphere that introduces a unusual way to learn computer science: read a series of charming fairy tales. Each post contains a few sentences of introduction to a computer science concept followed by a fairy tale illustrating that concept.

I particularly enjoyed Loops and Making Horseshoes which illustrates For and While loops through a blacksmith who gives orders to his dim apprentice. I’m not sure whether it was the intent of the piece, but the blacksmith’s frustration with having to repeat even the simplest instructions, precisely state the task to be repeated, and specify exactly when to stop reminded me of trying to communicate to a computer. The frustrations of having to provide exact specifications will be familiar to any programmer.

My main disappointment with the series is that there haven’t yet been any fairies. At first it appeared there might not be any magic. The excellent Caching and the Librarian of Alexandria discusses the magic of caching, but what Peter, the librarian’s apprentice, initially believes to be magic turns out, to his great disappointment, to be only clever caching strategy. There is magic, however, in the next tale, Pointers and Walk-in Closets, which features a wizard who tries various magical solutions to enable his many possessions to fit in a small downtown apartment’s closet before discovering the true magic of pointers.

Some of the tales feature dragons, princes, and knights. Others are hardly tales at all. For example, the enjoyable Computer Memory and Making Dinner is hardly a story, but the extended analogy it develops does a superb job in explaining the different types of memory. Even the most pedestrian of the tales has its own kind of magic.