Sidebar


JavaBeans versus ActiveX

Neither the original CORBA nor Java included a visual component model. To fill the gap, Sun is now providing JavaBeans. Sun defines a JavaBean as a reusable software component that can be manipulated visually in a builder tool. JavaBeans allows interaction with other Java components, ActiveX, and OpenDoc, and offers clients access to both visible and nonvisible components. An application must provide a container to run a bean, and beans can be nested. Beans offer persistence, so their state can be saved at the server for multirequest interactions. The public component state is represented by the following beans "properties":

"Methods" are the public behavior a component exhibits at run time, and "events" deliver and consume asynchronous notifications using a callback model, where clients register themselves as listeners; for additional details, see the textbox entitled "Beans Basics," by Emily Vander Veer.

Sun is working on Java/IIOP connectivity to CORBA services and sponsoring several new standards: Java Electronic Commerce Framework, Java Messaging Services, Java Management API, and Java Naming and Directory Services. Some services -- for example, the Java Transaction Service -- will be compatible with CORBA via IDL mappings. Yet another standard, RMI, can be used natively by Java programs as a fully distributed object infrastructure without CORBA or DCOM.

ActiveX

Like JavaBeans, ActiveX controls have properties (color, font, border, width attributes) and support events (clicks, key up/down, or messages from other controls) and methods (executable code). Because all controls must support the IUnknown interface and be able to self-register, it's easy to determine their functionality and establish interface pointers. These controls plug into containers that supply the runtime environment. In OLE, these were compound document containers; on the Web, they are browsers. The control notifies its container of events using event sinks. Containers and controls communicate via either outside-in activation, whereby a click on the container activates inner objects, or inside-out activation, in which the nested control is activated first and notifies container.

Possibly the greatest difference between JavaBeans and ActiveX controls are their runtime attributes. ActiveX controls are binaries, meaning you can download them and execute them locally. More importantly, they remain in local storage and are immediately available the next time your system needs them.