6.3 Another analogy

Think of a dog-and-pony show.

The choerograph of the show (if you can call it that!) is the CGI program/script. It specifies when the dog does this trick, when the pony does the other trick, and etc. A choerograph is the specification of how each actor/animal/object does its part in the show.

In an actual show (which correspond to the execution of a CGI script), an actual dog and an actual pony will be present. ``Dog'' and ``Pony'' are the names of the classes. ``Fido'' the show dog is an object of the class ``dog'', while ``Lightning'' the show pony is an object of the class ``pony''.

Depending on the states of Fido and Lightning, each show can be different from another. The choreograph can specify different moves and tricks depending the age, weight, height and other properties of the animal.

Furthermore, the choreograph uses actions that can be performed by the animals as the basic vocabulary, such as ``hop'', ``roll'', ``trot'', ``play dead'' and etc.

For example, we can consider the following segment of a choreograph: ``If Fido is mature, then tell Fido to play dead, while Lightning jumps over Fido.'' The `equivalent' Perl code may look like the following:

if ($fido->mature)
{
  $fido->play_dead;
  $lightning->jump_over($fido);
}

Copyright © 2008-05-09 by Tak Auyeung