The Makings of a Good Bean

Yes, if you look at it from this limited point of view, it would be easier to make SimpleBean an ordinary Java class. If I do so, however, I must incorporate SimpleBean into my program manually, by writing source code. But because I have declared SimpleBean to be a Bean, I can access it via a Bean-aware application builder, and I can visually insert it into my application and configure it.

The best candidates for “beanification” are those classes that have a strong visual element that can be customized at interface design time. A purely computational class would probably make a poor Bean, but an animated button and a spin control would be prime candidates because they can be inserted into an application visually.

Note In my description of the programmatic requirements for Beans, I introduce a number of topics—bound properties and event delegation, for example—that can apply to non-Bean classes as well. However, Beans must implement these features according to a standard practice, whereas non-Bean classes have no such restriction.

© 1997 by Scott Ladd. All rights reserved.