Bean is a reusable software component. Beans
can be combined to create an application.
Individual Java Beans will vary in the functionality
they support, but the typical unifying features
that distinguish a Java Bean are:
• Support for “introspection” so that a builder
tool can analyze how a bean works
• Support for “customization” so that when using
an application builder a user can customize
the appearance and behaviour of a bean.
• Support for “events” as a simple communication
metaphor than can be used to connect up beans.
• Support for “properties”, both for customization
and for programmatic use.
• Support for persistence, so that a bean can
be customized in an application builder and
then have its customized state saved away and
Beans v. Class Libraries
Not all useful software modules should necessarily
turn into beans. Beans are appropriate for software
components that can be visually manipulated
and customized to achieve some effect. Class
libraries are an appropriate way of providing
functionality that is useful to programmers,
but which doesn't benefit from visual manipulation.
So for example it makes sense to provide the
JDBC database access API as a class library
rather than as a bean, because JDBC is essentially
a programmatic API and not something that can
be directly presented for visual manipulation.
However it does make sense to write database
access beans on top of JDBC. So for example
you might write a “select” bean that at customization
time helped a user to compose a select statement,
and then when the application is run uses JDBC
to run the select statement and display the