The following questions on JavaBeans were recently asked of Andy Nguyen, Senior Product Marketing Manager, Authoring and Development Tools, Sun Microsystems, Inc.
JDJ: Why are JavaBeans components important for tools developers?
AN: JavaBeans is the only component architecture for Java technology.
JavaBeans is a portable, platform-independent component model written in Java that cuts down on application development time and leverages a portable code base to bring the "Write Once, Run Anywhere", Reuse Everywhere benefits of the Java platform to component software. JavaBeans components are 100% device-independent, 100% platform-independent and the component software architecture that allows a component or application to be certified as "100% Pure Java." They are designed to be reusable in the widest variety of development tools, containers and popular environments.
Sun developed the JavaBeans architecture in collaboration with other industry leaders to help Java developers create modular reusable components and more quickly develop or assemble network-aware solutions for heterogeneous environments within the enterprise or across the Internet.
JavaBeans components have met with widespread industry acceptance because they free developers from slow, expensive monolithic application development and builds up a portable, reusable code base, enabling developers to more quickly attack new market opportunities and new joint development opportunities. Even beyond the developer community, JavaBeans components are quickly becoming the component architecture of choice because they allow a new class of people to become software developers. Even designers with little programming experience can easily combine JavaBeans components to build custom applications and run them anywhere.
JavaBeans components can be reused in multiple solutions for deployment on an almost limitless variety of devices ranging from mainframe computers and PCs to network computers and cellular phones. These components can then be connected with other components to create applications and applets.
JDJ: How do developers and programmers use Java WorkShop to create JavaBeans as opposed to applets?
AN: First, let's explain the difference between JavaBeans components and applets.
A JavaBean component is a self-contained reusable software component that facilitates the development of Java applets and applications. Applets are Java bytecodes that run in the context of a browser like Hotjava, Explorer or Navigator.
Applets have a "life-cycle" where an "init" method is called when they are created, a "start" method is called when they are made visible, a "stop" method is called when they are no longer visible and a "destroy" method is called when they are destroyed.
Java WorkShop provides different project types: one for creating applications, one for applets and one for JavaBeans. Each project type provides a basic template for developing a project of that type.
It is advisable to design applets to work as reusable JavaBeans components by supporting JavaBeans properties and events. Similarly, developers can build applets out of Beans by following one of these two alternatives:
JDJ: How do developers and programmers determine the appropriate size for a JavaBean component while programming with Java WorkShop?
- A Bean can choose to subclass from java.applet.Applet, making the Bean a full-fledged applet. In this case, it is advisable that developers review the Beans properties that they support and decide which ones should also be settable as parameters to the "applet" or "object" tags.
Thus, an applet Bean might have a large number of JavaBeans component properties that can be configured inside an application builder and also make some of these properties visible as parameters to the HTML "applet" or "object" tag.
- Developers might use a generic wrapper applet that can run any arbitrary Bean inside a Web page. For example, we provide a generic BeanWrapper applet as part of the JavaBeans Development Kit (BDK) 1.0. This wrapper applet simply loads and runs a named Bean. As far as the user of the page is concerned, the Bean is running directly on the Web page.
AN: A JavaBean component can be any size and the size is determined by the complexity of the component being developed.
GUI JavaBean components can be small, for example sliders and buttons; medium, such as a simple table component for gathering data; or as complex as an entire spreadsheet. Simple non-GUI or invisible JavaBean components can be small for computing financial functions or complex to interact with commercial databases through JDBC.
JDJ: What's the next step for JavaBeans component development in Java WorkShop?
AN: Increasingly, users live in a world of composite, as opposed to monolithic, applications and environments (i.e., webtops, desktops, etc.). As a result, it is critical that developers have a standard, highly integrated and highly interoperable infrastructure to build upon.
The next release of the JavaBeans component model, code named "Glasgow," builds upon the existing JavaBeans component model and provides standards by which developers can provide increasingly sophisticated components and applications that offer users more seamless integration with their runtime environment, regardless of whether that environment is a PC desktop, webtop, etc.
To achieve this, Glasgow adds four new capabilities to the JavaBeans component model:
Three of the four specifications for Glasgow have been released for public review and are available for download. As in the past, Sun is working closely with our development partners in defining these specifications and will post the remaining specifications for review prior to finalizing them. Glasgow will be implemented in the next reference release of the Java Developers Kit (JDK). In addition, a version of the BDK will be released this summer based upon the Glasgow specifications.
- An extensible runtime containment and services protocol
- An object aggregation/delegation model
- A datatyping and object registry mechanism/activation framework
- Native platform-capable drag and drop services
Java WorkShop will continue to support the latest JDK and BDK..