The S/Java Interface:

Programming with Data on the Web

John Chambers and Mark Hansen

The S/Java interface is a programming environment that links the S and Java languages. In this environment programmers can quickly, and with little programming effort, link the data organizing and analysis capabilities of S with methods and toolkits for user interaction and graphics found in Java.

The S language is the standard medium for implementing new techniques arising from Bell Labs research in statistics, and for transferring the techniques to our Lucent Technologies colleagues; in addition, many of our collaborators themselves implement and adapt software in S for their own needs.

The interface exploits the object-oriented features of both S and Java. Programmers typically begin with existing software in Java for interactive graphics and existing S software for computing with data. Linking the software amounts to designing the information content the two sides want to share. Specifically, the programmer designs a class (often a simple one) to represent the data. We provide tools to handle the class in both S and Java, and to communicate objects in either direction.

This approach produces a universal interface in several senses:

  • The data transmission uses a standard, open format for S objects, defined in Version 4 of S . Our interface includes methods to transmit objects in either direction, given the definition of the class, so data transmission is transparent to the programmer, regardless of the class being used.

  • Actual data transmission is handled by a Java object server . Although the data format is completely general, it is simple enough that other versions of S or even other systems can send or receive objects through the server. We anticipate that the S/Java interface can grow in this way to a co-ordinated interface among many systems.

  • The use of Java to read and evaluate the objects means that the interface is geographically universal as well: the object server (e.g., S) and the applet viewer can communicate from any locations on the net.

  • Java is rich enough and has enough in common with S to make the graphics and interaction possibilities unlimited as well. All standard S graphics can be produced, but can also be extended in many ways (e.g., animation). Specialized displays and interactions can be programmed directly in Java, using the S object as the source of data for the display.
  • The interface can be used either on-line through a Java applet that supports running S, or off-line through URL's generated from the interface. The online interface lets S programmers develop new techniques for use with Java, using all the features of S. The off-line interface captures the output of the techniques and makes them immediately usable in Java applets unconnected with S. In particular, results can be developed in a secure environment and then inserted into an applet on a generally accessible site, with interaction and graphics using the Java methods, but without compromising the security of the underlying data.