Emerging Technologies: Java Beans

 

Executive Summary

This document provides a high level overview of Java Beans and its relationship to Java. Analogies are made to near-and-dear everyday products in an attempt to simplify an otherwise complex topic for a general audience. If you're a Java developer, this document is not for you, but you might want to send others here as a starting point. Hopefully after reading through the sections below, some of the more technical descriptions, provided in some of the links, will make sense. In the near future, all Internet users can expect to benefit from the application of Java Beans although many will not know it is in action.

 

 

What is Java?

Java is an object-oriented programming language developed and launched by Sun Microsystems in June of 1995. Java is object-oriented which means that instead of writing code that must be linked and executed in a predetermined fashion, a Java program creates objects (or applets as they are often called) which are stand alone blocks of re-usable code that perform a specific function(s).

 

O.K........, that was easy. Now, what is Java Beans?

Java Beans is a software component model. A software component model is a RAD (rapid application development) tool that defines how objects will be developed and how these objects can communicate with each other. The component model allows a developer or user to quickly build and customize an application by linking various objects together in much the same way that Legos are stacked together to build a house. Besides saving time and money, this provides more consistent, reliable applications. Like other RADs, such as Visual Basic and ActiveX, JavaBeans relies heavily on graphical interfaces that provide the characteristics of objects and how they are linked. Besides providing information about objects, Java Beans allows the developer to add, remove and alter objects to customize his/her own application. Relationships to other objects in the application are reestablished automatically.

Without component models such as Java Beans or ActiveX, we would be stuck with the current practice of placing static, stand-alone applets on Web pages. Java Beans extends Java by allowing interaction between different applets on a Web page as well as interaction between applets and Web pages themselves. A Beans can be GUIs, non-visual functions and services, applets, or even full scale applications designed to interact in any environment.

 

 

How does Java Beans work?

There are three steps to creating applications in the Java Beans environment. Using the analogy of a chef in the kitchen, Java Beans is to programming what Create-a-Meal is to cooking. Create-a-Meal provides the chef with a head-start versus cooking from scratch. With pre-mixed components to which the chef adds a meat of his/her choice, Create-a-Meal has made possible the concept of "modular" cooking. In a similar fashion, Java Beans provides the developer with the luxury of integrating pre-existing code rather than creating raw code from scratch.

  1. Introspection - In this step, the application developer studies a Bean to determine its properties and capabilities. What kind of bean is it.....pinto bean, black bean, garbanzo bean? There are two ways to introspect. First, for Beans developed according to pre-specified design patterns, the purpose of the Bean can easily be determined by its Method names . The second way is to employ the Bean Info interface which provides a brief description of each Bean in an aggregate summary format.
  2. Baking your Beans - No, really, this is the stage where the developer gets creative like a gourmet chef in the kitchen. Once the developer determines the property of a Bean, he or she may decide to customize a Bean. To do this, the developer again refers to the description methods described above and can then edit the properties of a given Bean to modify its behavior.
  3. Stirring the Beans - Once you have all the ingredients in the pot, its time to mix them together to create a culinary delight. Java Beans integrates the components which the developer has introspected and customized to create a complete application. The developer does this by registering the Listeners for each Event the Bean performs. This way when a Bean performs an event, all registered listeners are notified. In a nutshell, this step established the communications links between the Beans.

 

 

Why haven't I heard more about Java Beans?

You're probably wondering, "If Java Beans is so great, why haven't I heard more about it and less about ActiveX?" Microsoft and Sun are targeting and marketing their respective products in very different ways. Sun and its founder Scott McNealy have long touted the benefits of the network. The truth is that Sun really didn't know where to apply Java when it was first invented in 1991. Finally, WWW usage exploded and the answer became obvious that Java and JavaBeans could be positioned as the object-oriented tools of the Web. Sun then set up a distinct business unit, JavaSoft which is fully dedicated to the development and promotion of Java computing.

 In attempt to live up to the open systems promise, Sun began to give Java away. It published the source code, documentation and all related information on the Internet so that developers and organizations could begin to build Java based applications and tools. While giving up potential revenues on Java sales, this created a huge Java install base and won support in a variety of industries. In essence, Sun uses Java as a "loss leader" which promotes sales of other Sun products such as its popular Unix hardware products, accessories and applications. Sun also formed a strategic alliance with Netscape to incorporate Java into the company's Navigator browser. This alliance was key as it gave Sun instant presence on the world's most popular browser giving it a head-start against Microsoft.

 

 

Applications: Your National Bank (YNB)

Robust Java Beans applications are still something to envision in the future. The JDK 1.1 which includes Java Beans just became available this week during the second annual JavaOne conference. Presumably, we will start seeing dynamically interactive Web pages using this technology late this fall or early next spring.

To get an idea of the benefits of dynamic interaction which Java Beans will provide, consider an online consumer bank, Your National Bank (YNB). YNB will use Java Beans to allow customers to access their account information and market information over the Web, 24 hours a day. You're probably thinking, "OK, what's the big deal?" The "big deal" is that YNB will be able to offer Java components on its pages which will interact with one another to bring you real-time information.

 

YNB could offer an interest rate retrieval component, essentially a button the user would push to retrieve interest rate information. Once the button (a Bean) is pushed (an event), a registered listener will receive the information that the event took place and initiate a charting component on the same page. The charting component will proceed to graph interest rates for a certain period. Given that the charting component is reusable, run anywhere code, YNB could also use it in conjuction with another button (a Bean) on the same page to give you your account balance for the last two weeks. Now, you're probably saying, "Wow!!" (Alright, maybe there is only one exclamation point.) This is the beauty of Java Beans, the ability to re-use code, dynamically, in any environment.

 

Glossary of Terms

Event - An occurance or happening of significance to a task or program, such as the completion of an asynchronous input/output operation.
Listeners - For a lack of better words, listeners are the receptors which receive the information that the event has occurred. Once they receive this information, a chain reaction occurs down the line as another event is triggered and more listeners may be notified.
Method names - the characteristics, functionality and relationship of a Bean across environments embedded as descriptors within the Bean's code
 

 

Java Beans Resources on the Web

Java Jumps

Gamelan

JavaSoft

Component-based software with Java Beans and ActiveX

Integrating Java, Objects, Databases, and the Web - Jeff Sutherland

A great discussion in JavaWorld comparing Java Beans and ActiveX

 

 

If you have any questions or comments concerning this emerging technology overview, please contact us. Page last updated 3-31-97
Jonathan Stelling , David Williams , David Farrell , Joseph Kalogeras