This chapter does not appear in the book.
Java Art Chapters 1 and 2 looked at how to convert the source of a Java file into an image, an image that can be executed just like the original program. In this chapter and the next, I'll be explaining how to convert an executing program into a visual delight of ever-changing spirals, whorls, pinwheels, stars, tendrils, and other mesmerizing 'psychedelic' patterns (see above).
I won't be doing this by adding Java 2D drawing code to the application. Instead, my aim is to visualize a running program without adding to, or changing, its code.
The solution utilizes a combination of the Java Platform Debugger Architecture (JPDA) and Java Sound API (yes, sound), together with an open-source visualizer called Whorld, which interprets MIDI music commands as animations like the one at the top pf the page.
In this chapter I'll describe how to use JPDA to write a simple tracer which can monitor the execution of a program. In the next chapter I'll augment the tracer with the ability to transmit MIDI control commands to the Whorld visualizer, making it generate the required animation. The basic idea is illustrated by the picture on the right.
Although this example may seem a little silly, it does have a serious side. The visualization of executing code is a major research area, promising new ways to understand, debug, and monitor programs which are too complex to understand through purely textual means. The approach I use here (tracing with JPDA) has been employed in numerous research projects, although the visualization component has typically been much more complex: e.g. the generation of UML object and sequence diagrams, statecharts, cone trees, and call trees.