Java Studio: Dynamic Demonstrations of Java and Component-Based Development
- By Pat Shepherd
- December 28, 1999
|
|
Version Reviewed: 1.0
Current Version: 1.0
Cup rating system:
4 Outstanding
3 Good
2 Acceptable
1 Poor
Vendor Info
Sun Microsystems, Inc.
901 San Antonio Road
M/S MTV21-02
Palo Alto, CA 94303 USA
800.786.7638
512.434.1511
www.sun.com/studio
|
SEVERAL YEARS AGO, at the apex of the RAD movement, I worked on a project that was supposed to
use RAD techniques like prototyping and joint application design (JAD) to build a "great system in
record time at a minimal cost." You probably had a similar experience. And like me, many of you
probably discovered that the great dream of using an object-oriented technology like C++ alone didn't
deliver the lightning-fast application development cycle you were hoping for.
Even when component architectures like ActiveX made available a wide selection of components, serious
application development still centered on a developer and an IDE and required significant amounts of
specialized knowledge. Code almost always had to be written to support and enable the components used
in the application. Components usually did not truly plug-and-play, adding further to a time and
resource-intense software development process.
Nevertheless, the idea of visually building software with reusable components is so compelling that
developers continue to look for an equally compelling tool. Ideally, such a tool would allow you to
create an application using a purely visual notation. This means there is a need to have control
flow elements such as if…then, do…while, select…case, and so on. A wealth of existing
components is another requirement for minimizing the development effort and speeding up the
development cycle. It would also be great if you could use the tool to create new components and
sub-assemblies that are common to your business whether it's insurance or engineering. Application
deployment should be a breeze.
In addition to these generic capabilities, a Java-based tool should use JavaBeans as its component model
and should enable developers to create and add their own beans to the development environment. The tool
should also sport the other big advantage of Java—platform independence.
Java Studio's Design Window makes the connections between components obvious.
GOOD NEWS
AND BAD NEWS
The bad news is that Sun Microsystems' Java Studio will not magically solve all the problems
associated with software development. The good news is that Java Studio does bring us several steps
closer to the promised land of code-less, component-based, plug-and-play software development, that
will be faster, cheaper, and more efficient for developers and their clients.
Built solidly on the shoulders of the secure, cross-platform Java language and the JavaBeans component
architecture, Java Studio provides a painless code-free interface that allows for easy visual assembly
of JavaBeans components into larger units of functionality—applets, applications, or new compound
components. Today, developers have at their disposal a growing stack of software Legos™ that can
be imported and rapidly assembled in Java Studio in countless ways and distributed to users as working
software.
And even though this software Lego™ assembly kit has been touted—and accurately so—as a
low-tech tool for non-programmers, experienced Java developers have reason to work with their own
Java Legos™ in this bean-based environment. Java Studio shields non-programmers and novice users
from Java and the underlying event-based architecture that advanced developers know is at the heart of
JavaBeans. Advanced developers know, for example, that events are instances of classes, which subclass
the EventObject class that get passed to registered listener objects. But in Java Studio you
don't need to know this because JavaBeans components are visually connected to each other with snap-and-play
ease. All components are running "live" with connections and property modifications occurring
instantaneously as they are made.
On the other end of the usage spectrum, experienced Java developers can use Java Studio as a litmus
test or practical proving ground to ensure that their JavaBeans components deliver on the promise of
plug-and-play functionality. After all, who wants to be responsible for creating a bean that can't be
used as a true component because of a failure to make the component generic enough, to provide a
robust public interface or to adequately test it.
Java Studio also makes it easy to assemble fast prototypes—for either clients or internal
audiences—and provides a quick way to create new compound JavaBeans components. For those of you
involved in selling Java technology, this assembly tool makes a great centerpiece for demonstrating
Java and component-based development in a very graphic and compelling way.
The Java Studio environment will not let you fudge on a bean's interoperability with other beans
by "adding a little code here to call a particular method" or "a little code there to set some
attribute." Within Java Studio, beans must stand on their own merit. However, during development,
there probably will be times when you've got a bad or limited bean and it just isn't possible
(due to time or other factors) to send it back to its maker for a fix or a facelift. In this case,
you would want to hoist up the hood to tweak the code to work around the bug or the limitation in
that particular bean—but you can't in Java Studio. This is one main reason why Java Studio
probably is currently not acceptable for serious and sizable application development. So here's
the paradox—the code-less environment is one of the main advantages of Java Studio and, yet,
without code access, you are limited.
SCOPING OUT THE STUDIO
Java Studio installs easily using a standard installation program and is bean-ready in very short order.
The tool comes with a searchable online help system, tutorials, examples, a road map of the interface, and
a FAQ with lots of pointers. In addition, there is context-sensitive help to speed you directly to the
information you need.
When Java Studio opens, you are presented with three key windows: the Main Window, the GUI Window, and
the Design Window. The Main Window houses the Menu Bar, the Tool Bar, and the tabbed Component Palette.
All development within Java Studio centers on dragging JavaBeans components from the Component Palette
to either the GUI Window or the Design Window for manipulation and final assembly.
The GUI Window, showing only GUI components, represents the interface that the user will ultimately see
and interact with. It is here that you edit bean properties and where buttons, labels, text fields, and
the like are moved and re-sized for presentation to the user. Unfortunately, Java Studio lacks support
for layout managers (Java's mechanisms for display-independent relative positioning of GUI components).
The Design Window, showing both GUI and non-GUI components, is where all the real action takes place.
You can both modify bean properties and visually wire their input and output connectors together—without
the need of a soldering gun. Beans are wired together by drawing a line between their connectors allowing
the components to communicate through events that are sent and received through these connectors.
Another key aspect of Java Studio is something called a customizer. The customizer—a pop-up
dialog box—is the vehicle through which you change a bean's properties. The content and purpose of
each customizer depends on the individual bean.
PARTS AND PIECES
Java Studio serves up more than 50 of its own JavaBeans components including many basic programming
constructs, traditional GUI gadgets, and a smattering of Web widgets. So, you can work with the standard
set or bring your own beans to the assembly table by importing them. And if you want to expand your bean
collection, stop by the Java Component Depot (please see the link off the Java Studio page) where you can
search for JavaBeans components by company, product name, keyword, or application area. Java Studio's
standard components are easily accessible from the tabbed Component Palette.
The various components can be divided into GUI components, data flow components, computation components,
multimedia components, database components, Internet components, and debug components. There are a number
of additional components provided on the CD-ROM that are "unsupported" and must be imported in order to
use them.
The GUI components will probably be among the first a developer new to Java Studio will play with. Many
of these interface components are almost identical to their java.awt counterparts. Developers
and users alike will recognize such standard and familiar items as Button, Check Box, Choice, Text
Area, Text Field, Label, List, Menu, and Scrollbar controls.
The Menu component allows you to add menu options easily, including entry of the menu's name and output
value. Each added menu option causes the component's design representation to sprout input and output
connectors for enabling and disabling the menu option and for sending the menu's output value and name
to another component. A cautionary word: menus cannot be built in a cascading style. Menus can only have
one level of depth off the main menu bar.
A few of the components provide more complex and interesting user-interaction like the Direction
Button, Spin Control, Floating-Point Text Field, 3D Label, Slider, and Tickertape. The
Floating-Point Text Field, for example, allows the application builder to determine the component's
numerical precision.
Missing from the roster are components giving you the ability to create or use any type of additional
windows, message boxes, or dialog boxes. This makes applications created using standard Java Studio
components rather flat and one-dimensional. Also, it would be nice if Java Studio included a tabbed
component similar to the implementation of the Component Palette itself. For now, you can
always find one or create your own and import it. Also missing is the ever-popular radio button.
IN THE FLOW
Every component in the data flow category is a non-visual bean. These components fall roughly into
one of four categories: decision-making, storage, message directing and redirecting, and importing or
originating information.
In the decision-making category, the If and Switch components simply make an evaluation of
the input values and, based on the evaluation, send messages to the appropriate output connectors.
The storage components include the Adapter, which stores one or more values in separate
developer-definable storage areas and automatically sends out all values simultaneously as new values
arrive. The Memory component operates in a similar fashion but waits until it receives a
trigger event before it sends out any of the values from the storage areas. Both of these components
are ideal for accumulating values for use in calculations or directing program flow when various
trigger values are reached.
The message directing and redirecting sub-category contains very useful components for adapting and
channeling the output of one or more components to meet specific design needs. For example, the
Splitter component converts a single bi-directional connector into two separate input and
output connectors. The Multiplexor receives multiple messages and distributes them to
multiple destinations. The Merger component sends messages from multiple sources to a single
output. The Distributor component sends a single incoming message to two or more output
connectors.
To keep applications generic and adaptable to change, it is usually good practice to make certain
information (like database connection URLs) parameter-driven at application startup. The
External Connector component allows the developer to obtain such information from the
input parameters for the application. The Sequence Generator component can be used to
send out a sequence of numbers based on a starting value and a number that is used to increment
or decrement that value. This can be useful for creating unique IDs for new objects or database
rows. The Timer component simply sends out repeated messages separated by a definable
time interval.
DO THE MATH
The computational components are also non-visual components. These are used to perform various
types of computation on various types of data. The results of the computation get sent to the
component's output connector. One of the most basic is the Math component, which includes
such functions as PI(x), round(x), and random().
Calculations can be simple, as in the case of the Arithmetic component, performing such
arithmetic functions as addition, subtraction, multiplication, and division. Calculations can also
be quite complex, as in the case of the Expression Evaluator component. This component
evaluates an expression which you type in containing one or more variables using +, -, /, and *
to operate on the variables. The component automatically adds input connectors for each variable in
the expression. An example would be typing in "(a-b)/y", which would process three input parameters
and send the result to the output connector. I experimented with expression syntax to test the
component's robustness. For example, when I entered "a(b)c(d)", which did not separate the variables
with proper arithmetic operators, Java Studio responded well by popping up a warning that my
expression was "Not well formed."
Other computation components include the Logical component, the Logic Evaluator
component and the Relational component. These provide a variety of Boolean and
relational computations. The Logical component takes care of evaluating one or two input
values using AND, OR, XOR, or NOT operators. The Logic Evaluator component
handles more complex logical expressions in a single component. Finally, the Relational component
compares two numeric input values using relational operators =, !=, <=, and="">=.
There are three additional components in this lot: Constant, String, and Stack.
The Constant component stores a constant value such as a number or a string. The String
component manipulates, compares, or searches strings for values. And the Stack component
functions as either a standard stack (First In, Last Out) or a standard queue
(First In, First Out). These components are where you will accumulate reporting totals or
other information to help direct the application's flow.
SONG AND DANCE
The multimedia components are downright fun to use. For example, the Animator
component displays animations using an animated GIF file (a GIF file that contains several images of
equal dimensions). This component comes with nine pre-built animated GIF files including a running
man, two "wait" images, and an alarm.
If you want your application to allow processing when a user selects an area of a given image, then
the Image Map component will be a blessing in ease of use and power. This component lets
you import a GIF image and identify any combination of areas to be selectable by the user. When a
selectable area is clicked on, the component will send out selection events to one or more of the
appropriate output connectors.
The MontageLite drawing component gives the developer drawing, color, and font tools for
creating and displaying a multi-layered image. Each of five possible layers can be enabled through
one of the component's five input connectors. When the user rolls over or clicks on one of these
layers, the component sends the label of the layer to either the mouse enter or
mouse down output connectors.
The multimedia components are rounded out with a Sound Player. This component has 17
built-in sounds, ranging from bird chirps to a portion of the opera Figaro. You can also import
your own sound files as long as they are of the .au format. Importing invalid formats
may damage your speakers due to distortion.
ROUNDING OUT THE LIST
Developing a useful software application almost always involves reading and writing information
to a persistent storage medium like a RDBMS or some sort of file system. The Simple DBAccess
component allows you to connect to a database and manipulate data. The default implementation accesses
standard flat file databases in coma-delimited format but can be used with a relational database if you
swap in the correct JDBC driver.
Once you have connected to the database, you can use the Table component (an unsupported component)
to view information from the database. The Table Output component (a supported component)
displays records found in a database search. The Validation Text Field component, when
connected to the Simple DBAccess component, holds the label and value of a single column
in a database.
The URL Opener is the only Internet component included in the standard set. The
URL Opener opens a specified URL in the current browser window and can be used, for example,
to open different Web pages based on various conditions.
The Debug component, useful for tracking down data flow and computational errors, is a
non-visual component that monitors messages sent from one component to another. Messages can
optionally be sent to the Java Console window, a text window, or a log file. You also have the
option to set whether or not the Debug component is active during runtime.
The Java Studio CD-ROM contains a directory named contrib in which you can find more
than 20 additional unsupported components. Beware that these components may not be documented
beyond a few sparse words found in the text file in the same directory. In addition, these components
may provide unreliable results—use them at your own risk. You can easily load these extra
components into Java Studio through the Import/JavaBeans menu option. A wizard walks you through
the simple process.
Among the unsupported components are a Socket, a SocketServer, a spreadsheet-like
Table, an Instant BASIC Script interpreter, a non-Y2K compliant Date Text Field, a
CGI Form Gateway, a Calendar (that refused to load for me), and a Radio Box.
AND IN THE END
How does Java Studio stack up as a visual component-based development tool? Fairly well for a
version 1.0 product. You can indeed create complete—albeit simple—applications without
code. But I suspect that you'll need to purchase and/or create a fair number of your own beans to
accomplish much. The control flow components are limited and, although you can work around them,
a looping component would be nice.
All in all, application deployment is straight-forward, and you can use Java Studio to create new
components and sub-assemblies—a valuable capability. Application or component, the output from
the tool is compiled Java code so you get platform independence.
Java Studio serves several less obvious yet highly practical purposes that should not be overlooked.
The environment can act as a JavaBeans proving ground to help insure that the components you develop
meet the stringent requirements necessary for plug-and-play operability. Java Studio makes it easy
to assemble fast prototypes. Finally, Java Studio makes for dynamic demonstrations of Java and
component-based development. While you still need your IDE for more serious development, Java
Studio is an inexpensive, solid, easy-to-use tool that should fit snugly into the software toolbox
of both non-technical content developers as well as more experienced Java programmers.
Pat Shepherd is Director of Emerging Technologies at TYC Associates in Rockville, MD. He can be contacted at
[email protected].
=,>