5. Architecture of Algorithm Animation System




Most algorithm animation systems have libraries of animation routines and interface support. Some systems require manual insertion of calls to animation routines in the program implementing the algorithm. Earlier algorithm animation systems such as BALSA and TANGO were event-driven, i.e., a program generates output events in the form of messages to a message server. The message server passes the message to corresponding views. A view is a window in a display device where user views the animated objects. The message consists of information of an animated object. After the view received the message, it does the computation of redrawing the object and redraws it on the view.

Some of the recent systems were written in Java and all have very similar architectures. Examples of such systems are JSamba, the front-end of the POLKA system (see http://www.cc.gatech.edu/gvu/softviz/parviz/samba.html) and JAWAA (Java and Web-based Algorithm Animation, see http://www.cs.duke.edu/~rodger/tools), developed by Pierson and Rodger at Duke University in 1996. These systems adopt the conceptual framework of TANGO as their architecture. All systems will consist of three components, an animator, animation interpreter and animation viewer as shown in the following diagram:-

Architecture of Algorithm Animation
Fig. 2 Architecture of algorithm animation system.

The animator contains libraries of animation functions for drawing the animated objects on display devices. The animation viewer provides a graphical environment for showing the animation on display devices to the end users. The animation interpreter acts as a communication channel between the animation system and the end users. It reads in an ASCII script file provided by end user which contains plain text animation generating commands. The animation interpreter translates the script commands into the corresponding animation commands and passes control parameters of the animated object to the animator. The animator draws the animated object according to the control parameters of that object on to the animation viewer. Control parameters include x and y coordinates that specify where the animated object appears in the animation viewer or colour of the animated object.

The designer of the animation needs to generate an ASCII text file consisting of all the animation commands for generating the animation. This is done by inserting annotations in desirable states of the program written by the end users. Annotations can be a print line statement placed within any code in the program where the data or data structure is going to be animated. The annotation causes the program to output plain text animation commands to an ASCII text file. The script file is then passed to the system to generate animation of the execution process of the end users program. An example of a Java code segment which generates a script file of animation commands for two arrays, and highlights their elements in red, is written as follows:-

Code Example

The resulting script file will be the output of print statements in the code segment as shown below:-

Script Example

This script file is interpreted by the Animation Interpreter and the Animator generates animated objects for the two arrays and display them on the Animation Viewer. The final animation view by user is shown below:-

Array1 Array2
Array3 Array4
Array5 Array1
Fig. 3. Screen shots of animation


Back to top