Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesWrite Cosmic Code


August 1997 / Javatalk / Write Cosmic Code

Cosmo Code, soon to be combined with SGI's Cosmo Worlds 3-D development system, is a worthy Java IDE on its own.

Rick Grehan

With its "Cosmo" family of Web and 3-D development tools, Silicon Graphics, Inc. (SGI), is paving the way to a richer, more realistic experience on the Web. Tools now available from SGI's Cosmo Software business include Cosmo Worlds, a Virtual Reality Modeling Language (VRML) 2.0 authoring environment for creating interactive, 3-D Web applications; and Cosmo Code, a Java development system that's the subject of this month's column.

In the future, Cosmo Code and Cosmo Worlds will be combined to provide the core elements of Cosmo Studio, which will be a complete 3-D autho ring system with VRML as the graphics backbone and Java as the binding glue. SGI officials won't say exactly when Cosmo Studio will ship, but you can get a glimpse int o the future by using Cosmo Code today. I did, and I liked what I saw; Cosmo code is as good a Java integrated development environment (IDE) as I've seen.

Currently, Cosmo Code ($495) is available only for SGI workstations running Irix, but a Windows version should be released by the end of the year. All the elements of the Cosmo Code main window exist in other Java IDEs in one form or another. At the top are the menu and toolbar, just below is a pane for displaying source code, and at the bottom is a tabbed collection of panes called the "card panel."

The source-display pane also shows status information, such as compiler-error or warning messages. During a debugging session, just above this pane appears the thread bar. This is a series of tabs bearing the names of threads existing in the program. C olored indicator lights and icons affixed to each tab reveal the state of each thread, such as currently running, suspended, or dead.

The card panel provides different views into an application during development, execution, or debugging. You select which view is active by clicking on the appropriate tab, which brings the associated card to the top. These tabs are grouped into three broad categories-- development, debugging, and compile/execute.

For example, click on the project tab, and you're shown what amounts to a small file-manager window holding icons that represent the various files that make up your project. Click on the overview tab, and Cosmo Code shows you an inheritance diagram of the classes in the current project. During debugging, you can click on the call stack and follow the chain of methods calling methods as your program executes. Click on the data tab, and you can inspect the contents of variables, arrays, or even objects.

What makes the card panel useful (and permits it to bear the name "card") is the fact that you can "tear" a card off the panel and place it anywhere on-screen. The torn-off card becomes an independent window. Consequently, you can have several cards active at once, each providing different views into your application. Therefore, during a debugging session, you can concurrently view the progress of your application through a callback card while watching the state of variables in a data card.

Building Visually

Like other visual IDEs, Cosmo Code's Visual Builder lets you construct the visual aspects of your applet with drag-and-drop ease. Once you've dropped a visual object onto your applet's panel, you can double-click on that object; Cosmo Code then opens an object-inspector dialog box through which you can alter the object's properties (text, background color, events supported, and so forth).

Once you have a panel populated with visual objects, the real programming task begins: associating events triggered by one object to resulting be havior by another. I have always admired IBM's Visual Age products' approach, in which you "wire" together source and destination objects on-screen and then specify the characteristics of the interaction through IDE-guided dialog boxes. Cosmo Code's tack is similar. To program the causal relationship between, say, a button being clicked and a sidebar being cleared, you select the wire tool , click on the source button, and drag to the destination text box. This establishes the button as the source of the event, and the listbox as the respondent of the action. A dialog box pops up, in which you specify which event triggers the action as well as the method to be called on the receiving object.

Once you've done all this wire programming for the objects in an applet, Visual Builder lets you run the visual component portion of the application to verify that it functions as you meant it to. But this simulation goes only so far. You might, for example, want to code special behavior into yo ur application that the Visual Builder does not support. In this case, Cosmo lets you resort to user-defined methods--those that you write by hand and that are called in response to whatever events with which you associate them. (For example, you may want the clicking of a button to perform some elaborate calculation.)

Since Visual Builder can't compile and execute Java code on the fly, it's unable to execute user-defined methods. But this is a small and understandable limitation.

Cosmo Code is able to handle the 1.0.2 event model as well as the newer delegated event model released with the JDK 1.1. As you wire objects together and select events, Cosmo Code's dialog boxes point out which events and methods are deprecated (in the 1.0.2 version). This dual support is for compatibility reasons: Even now many of the browsers at work on people's desktops are still not up to the JDK 1.1 standard. So, were Cosmo to emit 1.1 code only, that code would likely break at most client sites.


Where to Find


Silicon Graphics, Inc.

Mountain View, CA 
Phone:    415-960-1980
Fax:      415-961-0595
Internet: 
http://www.sgi.com


HotBYTEs
 - information on products covered or advertised in BYTE


Become a Cosmic Coding Muffin

screen_link (82 Kbytes)

Cosmo Code's wire-guided programming is reminiscent of IBM's Visual Age for Java.


Rick Grehan is a senior editor at Computer Design magazine and coauthor of the Client/Server Toolkit (NobleNet, 1996). You can reach him at rickg@pennwell.com .

Up to the Javatalk section contentsGo to next article: VRML and JavaSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network