CPSC 124 Introduction to Programming Spring 2005

Using Jeliot

Jeliot ("The Algorithm Theatre") is a program (actually written in Java) which animates the execution of many Java programs, without having to write the program in any special way. (Mostly; see the limitations below.) Jeliot illustrates each of the steps that the computer goes through to carry out your program, and can be very valuable for learning the semantics (or meaning) of each Java statement.

Limitations

Jeliot unfortunately has some limitations, so it can't animate any Java program. Here are some of the limitations, and how to work around them. (Don't worry if you don't know what all these things mean - some of them will be covered later in the course.)

Note: if you make changes to a program to support Jeliot, make sure that you either don't save the modified program, or you save it with a different filename - don't overwrite your original program! The safest thing to do is to copy the file (using cp) before opening it with Jeliot.

There may be other things that Jeliot doesn't support, but it can handle many things that appear in typical programs.

Using Jeliot

Starting Jeliot

Start Jeliot by running

/classes/s05/cs124/jeliot/jeliot &

from the command line.

Make sure that the "show history view" checkbox on the Options menu is unchecked. (If you don't do this, the program animation will be slooooooooow.) You should only have to do this once; Jeliot remembers its settings.

Loading and Running a Program

Jeliot has two modes: edit and animate. When first started, Jeliot is in edit mode. You may type in a program in the area on the left side of the window (a basic program skeleton is displayed when Jeliot starts up), or you can use the File menu or buttons in the top left of the window to load an existing file.

Next, make any required changes to your program, as outlined under "Limitations" above. If you want to save the Jeliot-compatible program, make sure you choose "Save As" from the File menu and not Save (don't use the "Save" tollbar button either) so that you don't overwrite your original program. You may also use emacs to create a Jeliot-compatible version of your program and load that into Jeliot.

To run your program, press the "Compile" button at the bottom left of the window. The curtains on the right side of the window will be drawn back, and the display will be set up to start animating. You are now in "animate" mode. Use the controls in the bottom left of the window to control the animation - "Step" goes one step at a time, "Play" runs until you hit "Pause", "Rewind" sets the program up to run again from the beginning. You can control the speed of the animation with the slider.

When you are finished animating, click the "Edit" button at the bottom left of the window. This takes you back to "edit" mode and lets you edit the program, load a new program, or exit Jeliot.

Strategies

I recommend using Jeliot to step through the example programs from class, as well as programs you write. As you step through, quiz yourself on what you'd expect to happen next - and then check your answer by stepping Jeliot. Being able to read a program - that is, to know what the computer will do when it executes a statement - is an important skill for debugging programs as well as for writing programs.


Valid HTML 4.01!