Bean Internals  «Prev 

JavaBean Methods and Communication

Beans also communicate with the outside world through events, which are generated when the internal state of a Bean changes.
You learn much more about events later in this course.
A JavaBeans component is an object that conforms to a communication and configuration protocol, as prescribed by the JavaBeans specification.
The JavaBeans specification prescribes programming conventions and dynamic discovery mechanisms that minimize the design and implementation effort for small software components while supporting the design, implementation, and assembly of complex components.
The 3 fundamental aspects of the JavaBeans component as defined by the specification are events, properties, and methods.

Separation of Work Strategy

The success of the JavaBeans model is due in large part to its separation of work strategy.
Consider the design of a common graphical component such as a progress bar. The fundamental task of displaying a percent-completion bar is quite easily handled with basic drawing operations. With the JavaBeans model, you can implement a basic progress bar Bean in 200 lines of code or less. That is, with respect to design and implementation, the model does not impose any significant up-front overhead.
The majroity of the JavaBeans API is optional. Additional tasks such as supporting configurable foreground and background colors, vertical or horizontal configuration, and increment size are easily handled with minimal programming effort due to various API conventions.
The JavaBeans architecture, a modern component architecture, is designed for building independent software components from which programmers assemble larger application components. With JavaBeans components, programmers have total freedom to assemble components using traditional programming strategies or to use graphical builder tools to connect JavaBeans components, or to combine both techniques.
The JavaBeans architecture is the standard component architecture for Java technologies. The complete JavaBeans API is packaged in java.beans, one of the core Java APIs. This package includes interfaces and classes that support design or runtime operations. In developing a JavaBeans component, it is common to separate the implementation into design-only and runtime classes, so that the design-oriented classes (which assist programmers during component assembly) do not have to be shipped with a finished application.

Compact and Easy

JavaBeans components are simple to create and easy to use. This is an important goal of the JavaBeans architecture. It doe not take very much to write a simple Bean, and such a Bean is lightweight? It doesn't have to carry around a lot of inherited baggage just to support the Beans environment. If a Bean does not require the advanced features of the architecture, it doesn't get them, nor does it get the code that goes with them. This is an important concept. The JavaBeans architecture scales upward in complexity, not downward like other component models. This means it really is easy to create a simple Bean. The previous example shows just how simple a Bean can be.