Beans Defined

Like ActiveX controls and COM components, Java Beans can be scaled to a variety of tasks. Some Beans will be components of visual interfaces—buttons and switches, for example. Other Beans will be “invisible” components, such as timers and parsers. And complex Beans can define embeddable applications, such as spreadsheets and calculators. In many cases, a Bean will itself contain or extend other Beans—a practice that is at the core of object-oriented programming.

So what exactly is a Java Bean? In the simplest sense, a Bean is a Java class that adheres to specific coding conventions so that the class’s properties and methods can be discovered by other software components. A Bean allows itself to be customized in appearance and behavior; it supports events that communicate its actions, and it can support a persistence mechanism to save its state for later restoration. But in its simplest form, a Java Bean need be nothing more than a Java class that is made available to other components through a special packaging mechanism. A Bean-aware builder tool or development environment can identify Beans and make them available for visual placement into an application. Thus you can add Java Beans to an application in the same way that you insert ActiveX and OLE controls into a Microsoft Visual Basic form, by selecting them from a list and “drawing” them.

© 1997 by Scott Ladd. All rights reserved.