Zat Home Zat Home Zat - Tools for the Future of the Internet


Spin™ Tour

Using Spin is as easy as A B C

A is for Actor

The Spin IRAD environment uses an advanced behavior-based authoring paradigm combined with a state-of-the-art component architecture — unlike other visual authoring tools based on actors and behaviors, Spin allows arbitrary JavaBeans components to be used as actors. You simply drop them in, and they go to work for you.

Actors have methods (commands) they respond to, events they generate, and properties you can edit. Spin automatically determines what these are (through introspection) and builds a menu for each actor so you can invoke methods and edit properties. Here is the juggling Duke JavaBean, downloaded from Sun's web site and dropped into Spin. If you were looking at this in Spin, of course, Duke would actually be juggling. You can stop him from juggling by selecting the stopJuggling() method from the menu. You can also make him juggle faster or slower by editing the AnimationRate property.

Actor with menu

Here is another JavaBean that renders a random fractal landscape:

Random Fractal Landscape

Here's a JavaBean that implements a full, Excel compatible spreadsheet showing a mortgage calculation:

Spreadsheet Component

In an interesting twist to the normal web there is a JavaBean that implements a web browser, so you can display arbitrary HTML pages inside your application — it even understands Java!

Unlike in many tools, actors do not have to be visual; any object can be an actor. There are thousands of JavaBeans available — over 250 companies are selling JavaBeans — and more are being created every day. In addition, Sun has free bridge tools so that CORBA components and Microsoft COM (ActiveX) components can be converted easily into JavaBeans. Zat's Components page lists sources for JavaBeans. You can also create new JavaBeans in Spin, without programming. And if you are a programmer, you can use one of the many excellent Java programming environments to create new JavaBeans.

B is for Behavior

Behaviors are just one of the significant ways that Spin differs from tools that claim to let you develop applications, but are really just JavaBean editors. Spin is a real Internet RAD (Rapid Application Development) environment that provides behaviors for connecting actors together.

A Spin behavior is just like a human behavior — it has a stimulus and a response. The simplest kind of behavior is an action behavior. An action behavior is stimulated by an event coming from an actor, and responds by executing a method on an actor (either the same actor or a different one).

For example, here is a simple application containing another juggling JavaBean (our Zat mascot — a juggling Zen bodhiZATva) and a standard scrollbar:

Two actors and a behavior

We want to use the scrollbar to control how fast Duke juggles. To do this, we use an action behavior. The action behavior is the small icon containing a red arrow attached to the bottom of the scrollbar. If you double click on it, you get the following dialog:

Action Behavior

This behavior is activated whenever the adjustment value of the scrollbar changes, and responds by sending a message to the juggler to set its animation rate. Behaviors are easy to create, because Spin suggests appropriate values when the user clicks on the triangular arrow to the right of each field.

One of the most powerful features of Spin is that it allows arbitrary expressions to be used as values in behaviors. So in the preceding action behavior, you can use an expression for the animation rate:

Action with Expression

Spin is unique in that these expressions can be any Java expression, including calls to math functions, random number functions, or thousands of other useful functions. Spin automatically takes care of name resolution, conversions to and from primitive types, and other bookkeeping tasks so that scripting in a full-featured language like Java is just as easy as scripting in the limited (and proprietary) scripting languages usually found in visual authoring tools (assuming they provide any scripting language at all).

If you need to do scripting more complicated than an expression, Spin provides a script behavior. Here is a script behavior from another Spin application, which displays graphs for stock market data. It contains a loop to test if a stock symbol is one that it has already seen, and if not, adds it to a list of stock symbols:

Script Behavior

Of course, this functionality could be provided by a JavaBean component, but the point is that if some required functionality is not provided by a component you can always add it using a script.

As an indicator of the unprecedented flexibility of Spin, here is another kind of behavior, called a timeline. A timeline lets you control actors over time.

Timeline Behavior

In Spin, you are not restricted to a single authoring paradigm. You can mix timeline-based authoring with actor-based authoring, and a single application can even contain multiple timelines. Plus in Spin, you can control any property of an actor with a timeline, going far beyond existing timeline-based authoring systems.

We have only covered three of Spin's behaviors. Spin has a full set of behaviors, plus you can author new behaviors in Spin itself, save them, reuse them, even share them with other Spin users.

C is for Capsule

Most visual authoring environments let you build small toy projects, but things quickly get out of hand when you try to build anything significant. Spin helps you tame complexity with a unique feature called capsules. Capsules give an unprecedented degree of modularity in a visual authoring environment, so that large and complex projects are much easier to build, debug, and modify.

Here is an outline view of a capsule that contains three actors and several behaviors.

Outline view of a Capsule

You can specify the type of a capsule, and define properties, methods, and events on it.

Capsule Properties

You can author anything in Spin:

No other visual authoring environment is this flexible. You can even use capsules to define new components (actors), which you can reuse and share.

D is for Data

Spin has a full set of data types, from simple data types like integers and strings, to more complex types like points and colors, and even specialized types like URLs and HttpCookies. In the outline view of a capsule (above) there are two data objects shown, an integer called amplitude, and a point called startPos.

Each data type is easily editable. For example, here is the color editor.

Color Editor

E is for Editor

Editors are one of the most important parts of Spin. In fact, we have already seen several different kinds of editors in this tour, such as the color editor, the outline view editor for a capsule, and several different editors for different kinds of behaviors.

What makes Spin so amazing is the flexibility of editors. You can define your own custom editors for actors, and you can have more than one kind of editor for the same type of object. For example, here is the toybox view of the same capsule shown in the previous outline view.

Toybox view of a Capsule

The toybox view is especially powerful because it does not have separate edit and run modes. You can test and play with your application while you build it. Spin automatically knows which changes are permanent changes to your application and which are just interactions with it.

F is for Facilities for Debugging, Tracing, and Testing

Spin has an amazing level of debugging facilities for a visual authoring environment. When Spin detects an error, either at authoring time or execution time, it displays an error message for the error. One click on the error and Spin takes you to the exact object that caused the error, so you can correct it.

In addition, at your command Spin can display event flow and method invocation in a capsule, so you never have to guess what activated a behavior, or who invoked a method on an actor. And you can show this for all objects in a capsule, or just for a single object. This outline view is showing the events for only the counter (in blue), and all method invocations for the entire capsule (in red).

Trace view

Here are two of the example programs that come with Spin, showing the debugging facilities. The first is the clock example, which is a combination analog, digital, and cuckoo clock.

The left-hand window shows the outline view for the clock, showing the second, minute, and hour hands, as well as the chime (cuckoo) and the digital clock. The blue arrows show how the "time" actor sends events to the "tick" action in the second, minute, and hour hands. The red arrows show how the behaviors invoke methods on their actors. The upper-right window shows the toybox view. The small red circle is the second hand. The lower-right window shows the "setCount" behavior for the chime. It sets the count of the number of times to chime (cuckoo) to the current hour.

Here is a view of the stock graph example, which takes a ticker symbol and displays a graph of the stock price (fetched from the Internet).

The right-hand window is the toybox view, showing the four main parts of this example: a window for typing in the ticker symbol, a button to fetch and display the graph, a list of symbols already displayed, and the graph itself. These correspond to the four actors in the outline view: tickerText, displayButton, history, and stockGraph. The bottom window shows the setURL behavior, which creates the URL for fetching the stock graph from the ticker symbol.

Debugging support for servlets is especially impressive. Normally, debugging server-side programs is very difficult, since they run inside a web server and the only way to invoke them is from a separate web browser. Usually if a server-side program contains an error, the only way to find it is by tedious trial-and-error, or by manually inserting statements to send debugging information to the browser as HTML.

Spin has a built-in web server to run servlets. Spin's web server will send the HTML output of your servlet to any browser. You can examine values, set breakpoints and single-step through the servlet, even while it is running! With Spin, building and debugging servlets is a breeze.

Here is a servlet, being debugged in Spin:

This servlet responds to both CGI GET requests and POST requests, using the "getAction" and "postAction" behaviors, respectively. In this case, we are debugging how it responds to a post request. The fat red arrow at the left side of the outline view shows that Spin has stopped just before the execution of the getName behavior. The long red arrow in the right side of the outline window shows that the "getName" behavior sets the value of the "name" variable.

To the left of the capsule outline window is the debug console. This window allows us to single step through a servlet. It is also displaying the value of the "name" variable, so we can see that it is set to the correct value, in this case to "Spin". The large window is a standard browser, Netscape Navigator, showing the results of running our servlet. The built-in web server in Spin can run any servlet and send its results to any browser (running either locally or on another machine).

Thank you!

This tour has shown just a few of the major features of Spin. And since Spin is component based, it is extensible, so new features can be added by us, by third parties, and even by you. Go to the download page and give Spin a spin!

| Back to Spin | Download Spin | Zat Home |

3D Zat Logo