Visualize pointers by UBRVM (Ultimate Basic Reference VM)

From OO Lab
Jump to: navigation, search

Reference VM

Pointers in C, C++ and references in Java are essential programming language constructs. Most programmers have become accustomed to unfolding a variable in the watch window of a debugger. When a pointer is used in a computer program, typically a programmer wants to establish a binary relation between two objects. Visualizing a binary relation is common and, in most cases, not dispensable.

Pointer, however, is a still a binary relation except that the relation is cross objects. A binary relation that within an object or an array can use visualization described inRelationVM. However, to visualize a binary relation across objects, xDIVA introduces a kind of VM called Ultimate Basic Reference VM (UBRVM). They are actually specialized binary relation VM but we use reference VM to refer this type of VM.

Currently, there are three kinds of UBRVMs implemented. They are:

  • ubrvm_laser
  • ubrvm_line
  • ubrvm_orbit
  • ubrvm_autounfold

ubrvm_laser

Let's go through an example to get familiar with these reference VM. Please open bt.java and set breakpoint at the end of the problem. Let's visualize root usingubrvm_laser

Laserreference.jpg

Let a pointer link a source VM to a destination VM. Using a UBRVM you need to at least connect a pointer-type variable to the port wop and you need to choose a VM to become the source VM of this binary relation. In the example, we use a torus shape to be the source VM. If you click the torus, it will emit a laser to the destination VM. As you may already know it, the destination VM is contructed when this pointer is unfolded. UBRVM can be viewed as a specialized version of binary relation VM but its destination VM is not known before the pointer is unfolded.

In previous tutorials, we use ball_laser frequently. This referece VM is actually use Sphere_UBVM as the source VM and packaged with laser_ubvm in Composer. UBRVMs are also treated as basic building block. You can create arbitrary shape to be the source VM.

Orbit_ubrvm

orbit_ubrvm is particularly interesting. Suppose it is used to visualize a relation between two VMs, namely vm1 and vm2. When vm1 is clicked, an Ogrehead (the mascot of Ogre) will appear to orbit vm2. The screen shot below shows an example of using this UBRVM with a sphere be its source VM.

Ogrehead.jpg

AutoUnfold VM

AutoUnfold VM is also a commonly used reference VM. It is explained in autounfold for more details.

Personal tools