his chapter provides an overview of Java Beans. Beans are important because they allow
you to build complex systems from software components. These components may be
provided by you or supplied by one or more different vendors. Java Beans defines an
architecture that specifies how these building blocks can operate together.
To better understand the value of Beans, consider the following. Hardware designers have
a wide variety of components that can be integrated together to construct a system. Resistors,
capacitors, and inductors are examples of simple building blocks. Integrated circuits provide
more advanced functionality. All of these different parts can be reused. It is not necessary
or possible to rebuild these capabilities each time a new system is needed. Also, the same
pieces can be used in different types of circuits. This is possible because the behavior of these
components is understood and documented.
The software industry has also been seeking the benefits of reusability and interoperability
of a component-based approach. To realize these benefits, a component architecture is needed
that allows programs to be assembled from software building blocks, perhaps provided by
different vendors. It must also be possible for a designer to select a component, understand
its capabilities, and incorporate it into an application. When a new version of a component
becomes available, it should be easy to incorporate this functionality into existing code.
Fortunately, Java Beans provides just such an architecture.
What Is a Java Bean?
A Java Bean is a software component that has been designed to be reusable in a variety of
different environments. There is no restriction on the capability of a Bean. It may perform
a simple function, such as obtaining an inventory value, or a complex function, such as
forecasting the performance of a stock portfolio. A Bean may be visible to an end user. One
example of this is a button on a graphical user interface. A Bean may also be invisible to a
user. Software to decode a stream of multimedia information in real time is an example of
this type of building block. Finally, a Bean may be designed to work autonomously on a user 's
workstation or to work in cooperation with a set of other distributed components. Software
to generate a pie chart from a set of data points is an example of a Bean that can execute locally.
However, a Bean that provides real-time price information from a stock or commodities
exchange would need to work in cooperation with other distributed software to obtain its data.
Search WWH :