What are JavaBeans?
Home ] Up ] [ What are JavaBeans? ] The Bean Development Kit ] The BeanBox ] JavaBean Properties ] Simple and Indexed Properties ] Bound Properties ] Constrained Properties ] Bean Deployment ] Introspection ] Property Editors ] Customizers ] Bean Persistence ] New JavaBean Features ]

 

 

Software Components have been the "holy grail" of software development for some time. The idea is to take a page out of the hardware designers' book, and come up with a set of components ("Software ICs", to use a term coined by Brad Cox) (IC = Integrated Circuit) which can be plugged in, where appropriate, to build complex systems from more manageable, smaller, pieces.

The grand vision of reusable Software Components has not yet come to pass. However, there are some outstanding successes in the field -- notably Microsoft's Visual Basic (VB). VB has been incredibly successful (despite many professional programmers' disparagement of the BASIC language), and has spawned a veritable cottage industry of reusable VB components -- or to use Microsoft's term VBXs. In fact, VBXs have been changed into more general components called OCXs, and absorbed into a more generalized component model called COM (or ActiveX, or DNA, or whatever Microsoft's latest nom du jour (name of the day) might be).

Not to be outdone, JavaSoft decided that the lure of shareable, reusable software components was too great to pass up, and so they decided to come up with their own component model, which they call JavaBeans.

Use of Components in an IDE

One of the really powerful ideas that VB had was that you could develop a component inside the VB IDE (Interactive Development Environment) using primarily point and click operations, with a bit of typing here and there. In this way, you can build a component, and incorporate it into a large application. What is even more powerful an idea is that others can do the same thing, and then sell the components for use in other people's applications. With VB, it is literally true that you can build a relatively complex application by buying the appropriate set of components, plugging them into your application, and setting various properties and interactions among the components.

Note that most VB components are visual components. They are typically used in a GUI to present results or accept inputs and respond with visual changes.

JavaBeans also focusses on primarily visual components. However, it was a requirement that JavaBeans be usable in a number of different IDEs, most of them not from JavaSoft/Sun. Consequently, it was important that JavaSoft come up with a mechanism that was very easily usable within a number of different visual environments.

All of the major Java IDEs support JavaBeans:

  • JBuilder
  • Eclipse
  • NetBeans
  • etc.

JavaBean Components

A JavaBean exports properties, events, and methods.

  • A property represents a piece of the bean's internal state. Properties affect a Bean's appearance and behavior. They may be changed at design time. A builder tool can examine a Bean's properties and expose them for manipulation within the tool environment (typically an IDE).
  • A bean may generate events. Events are used to communicate with other Beans. A Bean that wishes to receive events (a listener Bean) registers its interest with the Bean that fires that event (a source Bean). A builder tool can examine a Bean and determine which events the Bean can fire (send), and which it can handle (receive).
  • A Bean makes available (exports) a set of public methods. A Bean's methods can be called from other Beans, or from other environments. By default, all of a Bean's public methods are exported.

All these are important for an IDE to "understand" at design time, as well as for the bean to work correctly at run time.

 
The page was last updated February 19, 2008