The Wolf and the n Pigs: a Fable

The tale of the wolf and three pigs is a very common one; it is abstracted briefly below.

Once upon a time there lived three pigs and a Big Bad Wolf. Pig1 constructs a house of straw; BB Wolf blows it down and eats pig1. Pig 2 constructs a house of sticks; BB Wolf blows it down and eats pig2. Pig3 constructs a house of bricks, which BB Wolf cannot blow down. Pig3 takes revenge on Wolf and kills him by boiling him in water, and Pig3 lives happily ever after.

This is an old "classic" fable, and we tell it to young children?

So what does this "parable" have to do with computing? Well it says something about building properly using big building blocks.

The straw house could correspond to building in a low level language, close to the machine, with its many commands (load, store, shift, branch, goto, etc). Sticks correspond to the higher level commands such as if, while, for, etc. Bricks correspond to even higher level constructs such as functions and routines.

In computing we can go to more levels, both higher and lower levels. A lower level corresponds to building out of zeros and ones. The fable could be extended to involve a Pig0 who builds out of feathers, spaghetti, jelly, cards, sugar cubes or worse.

At the other extreme we can go to higher levels, building out of modules, classes, libraries, components. The corresponding Pig(n) would build using walls, rooms, and perhaps prefabricated homes.

In a possible sequel fable, BB Wolf gets reincarnated bigger and badder, as alien or computer, but Pig(n+1) is also reincarnated (by induction, yet), with new grail, silver bullet or other wonderous thing.

Movie rights are reserved.